bella-companion 0.0.14__py3-none-any.whl → 0.0.16__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.
Files changed (25) hide show
  1. bella_companion/fbd_empirical/beast_config.xml +117 -0
  2. bella_companion/fbd_empirical/data/traits.csv +122 -122
  3. bella_companion/fbd_empirical/data/trees.nwk +46 -46
  4. bella_companion/fbd_empirical/results.py +6 -6
  5. bella_companion/fbd_empirical/run_beast.py +10 -28
  6. bella_companion/fbd_empirical/summarize_logs.py +2 -2
  7. bella_companion/simulations/beast_configs/epi-multitype/GLM.xml +81 -0
  8. bella_companion/simulations/beast_configs/epi-multitype/MLP.xml +81 -0
  9. bella_companion/simulations/beast_configs/epi-multitype/Nonparametric.xml +65 -0
  10. bella_companion/simulations/beast_configs/epi-skyline/GLM.xml +71 -0
  11. bella_companion/simulations/beast_configs/epi-skyline/MLP.xml +73 -0
  12. bella_companion/simulations/beast_configs/epi-skyline/Nonparametric.xml +57 -0
  13. bella_companion/simulations/beast_configs/fbd-2traits/GLM.xml +101 -0
  14. bella_companion/simulations/beast_configs/fbd-2traits/MLP.xml +98 -0
  15. bella_companion/simulations/beast_configs/fbd-2traits/Nonparametric.xml +70 -0
  16. bella_companion/simulations/beast_configs/fbd-no-traits/GLM.xml +88 -0
  17. bella_companion/simulations/beast_configs/fbd-no-traits/MLP.xml +86 -0
  18. bella_companion/simulations/beast_configs/fbd-no-traits/Nonparametric.xml +62 -0
  19. bella_companion/simulations/generate_data.py +3 -3
  20. bella_companion/simulations/metrics.py +0 -4
  21. bella_companion/simulations/run_beast.py +5 -4
  22. {bella_companion-0.0.14.dist-info → bella_companion-0.0.16.dist-info}/METADATA +2 -2
  23. {bella_companion-0.0.14.dist-info → bella_companion-0.0.16.dist-info}/RECORD +25 -12
  24. {bella_companion-0.0.14.dist-info → bella_companion-0.0.16.dist-info}/WHEEL +0 -0
  25. {bella_companion-0.0.14.dist-info → bella_companion-0.0.16.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,101 @@
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
+ <Normal id="weightsPrior" mean="0" sigma="1"/>
30
+ <Uniform id="birthRatePrior" upper="$(birthRateUpper)"/>
31
+ <Uniform id="deathRatePrior" upper="$(deathRateUpper)"/>
32
+
33
+ <run spec="MCMC" chainLength="10000000">
34
+ <state id="state">
35
+ <stateNode spec="RealParameter" id="birthRateScaler" value="1"/>
36
+ <stateNode spec="RealParameter" id="deathRateScaler" value="1"/>
37
+ <stateNode spec="RealParameter" id="birthRateW" value="0"/>
38
+ <stateNode spec="RealParameter" id="deathRateW" value="0"/>
39
+ </state>
40
+
41
+ <distribution id="posterior" spec="CompoundDistribution">
42
+ <distribution id="likelihood" spec="CompoundDistribution">
43
+ <distribution spec="BirthDeathMigrationDistribution" tree="@tree" typeTraitSet="@typeTraitSet">
44
+ <parameterization spec="CanonicalParameterization" processLength="$(processLength)" typeSet="@typeSet">
45
+ <birthRate id="birthRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)" typeSet="@typeSet">
46
+ <skylineValues id="birthRate" spec="glmprior.util.GLMLogLinear" coefficients="@birthRateW" scaleFactor="@birthRateScaler" transform="false">
47
+ <predictor spec="RealParameter" value="$(timePredictor)"/>
48
+ <predictor spec="RealParameter" value="$(trait1Predictor)"/>
49
+ <predictor spec="RealParameter" value="$(trait2Predictor)"/>
50
+ <predictor spec="RealParameter" value="$(randomPredictor)"/>
51
+ <indicators spec="BooleanParameter" value="1"/>
52
+ </skylineValues>
53
+ </birthRate>
54
+ <deathRate id="deathRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)" typeSet="@typeSet">
55
+ <skylineValues id="deathRate" spec="glmprior.util.GLMLogLinear" coefficients="@deathRateW" scaleFactor="@deathRateScaler" transform="false">
56
+ <predictor spec="RealParameter" value="$(timePredictor)"/>
57
+ <predictor spec="RealParameter" value="$(trait1Predictor)"/>
58
+ <predictor spec="RealParameter" value="$(trait2Predictor)"/>
59
+ <predictor spec="RealParameter" value="$(randomPredictor)"/>
60
+ <indicators spec="BooleanParameter" value="1"/>
61
+ </skylineValues>
62
+ </deathRate>
63
+ <migrationRate spec="SkylineMatrixParameter" skylineValues="$(migrationRate)" typeSet="@typeSet"/>
64
+ <samplingRate spec="SkylineVectorParameter" skylineValues="$(samplingRate)" typeSet="@typeSet"/>
65
+ <removalProb spec="SkylineVectorParameter" skylineValues="0.0" typeSet="@typeSet"/>
66
+ <rhoSampling spec="TimedParameter" values="1" times="$(processLength)" typeSet="@typeSet"/>
67
+ </parameterization>
68
+ <startTypePriorProbs spec="RealParameter" value="$(startTypePriorProbs)"/>
69
+ </distribution>
70
+ </distribution>
71
+
72
+ <distribution id="prior" spec="CompoundDistribution">
73
+ <distribution spec="Prior" x="@birthRateScaler" distr="@weightsPrior"/>
74
+ <distribution spec="Prior" x="@deathRateScaler" distr="@weightsPrior"/>
75
+ <distribution spec="Prior" x="@birthRateW" distr="@weightsPrior"/>
76
+ <distribution spec="Prior" x="@deathRateW" distr="@weightsPrior"/>
77
+ <distribution spec="Prior" x="@birthRate" distr="@birthRatePrior"/>
78
+ <distribution spec="Prior" x="@deathRate" distr="@deathRatePrior"/>
79
+ </distribution>
80
+
81
+ </distribution>
82
+
83
+ <operator spec="BactrianScaleOperator" parameter="@birthRateScaler" weight="30.0"/>
84
+ <operator spec="BactrianScaleOperator" parameter="@deathRateScaler" weight="30.0"/>
85
+ <operator spec="BactrianRandomWalkOperator" parameter="@birthRateW" weight="30.0"/>
86
+ <operator spec="BactrianRandomWalkOperator" parameter="@deathRateW" weight="30.0"/>
87
+
88
+ <logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
89
+ <log idref="posterior"/>
90
+ <log idref="prior"/>
91
+ <log idref="likelihood"/>
92
+ <log idref="birthRateSP"/>
93
+ <log idref="deathRateSP"/>
94
+ <log idref="birthRateW"/>
95
+ <log idref="deathRateW"/>
96
+ <log idref="birthRateScaler"/>
97
+ <log idref="deathRateScaler"/>
98
+ </logger>
99
+ </run>
100
+
101
+ </beast>
@@ -0,0 +1,98 @@
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
+ <Normal id="weightsPrior" mean="0" sigma="1"/>
28
+
29
+ <run spec="MCMC" chainLength="10000000">
30
+ <state id="state">
31
+ <plate var="n" range="$(layersRange)">
32
+ <stateNode spec="RealParameter" name="stateNode" id="birthRateW$(n)" value="0"/>
33
+ <stateNode spec="RealParameter" name="stateNode" id="deathRateW$(n)" value="0"/>
34
+ </plate>
35
+ </state>
36
+
37
+ <distribution id="posterior" spec="CompoundDistribution">
38
+ <distribution id="likelihood" spec="CompoundDistribution">
39
+ <distribution spec="BirthDeathMigrationDistribution" tree="@tree" typeTraitSet="@typeTraitSet">
40
+ <parameterization spec="CanonicalParameterization" processLength="$(processLength)" typeSet="@typeSet">
41
+ <birthRate id="birthRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)" typeSet="@typeSet">
42
+ <skylineValues id="birthRate" spec="bella.BayesMLP" nodes="$(nodes)">
43
+ <predictor spec="RealParameter" value="$(timePredictor)"/>
44
+ <predictor spec="RealParameter" value="$(trait1Predictor)"/>
45
+ <predictor spec="RealParameter" value="$(trait2Predictor)"/>
46
+ <predictor spec="RealParameter" value="$(randomPredictor)"/>
47
+ <plate var="n" range="$(layersRange)">
48
+ <weights idref="birthRateW$(n)"/>
49
+ </plate>
50
+ <activationFunctionsOutput spec="bella.Sigmoid" upper="$(birthRateUpper)"/>
51
+ </skylineValues>
52
+ </birthRate>
53
+ <deathRate id="deathRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)" typeSet="@typeSet">
54
+ <skylineValues id="deathRate" spec="bella.BayesMLP" nodes="$(nodes)">
55
+ <predictor spec="RealParameter" value="$(timePredictor)"/>
56
+ <predictor spec="RealParameter" value="$(trait1Predictor)"/>
57
+ <predictor spec="RealParameter" value="$(trait2Predictor)"/>
58
+ <predictor spec="RealParameter" value="$(randomPredictor)"/>
59
+ <plate var="n" range="$(layersRange)">
60
+ <weights idref="deathRateW$(n)"/>
61
+ </plate>
62
+ <activationFunctionsOutput spec="bella.Sigmoid" upper="$(deathRateUpper)"/>
63
+ </skylineValues>
64
+ </deathRate>
65
+ <migrationRate spec="SkylineMatrixParameter" skylineValues="$(migrationRate)" typeSet="@typeSet"/>
66
+ <samplingRate spec="SkylineVectorParameter" skylineValues="$(samplingRate)" typeSet="@typeSet"/>
67
+ <removalProb spec="SkylineVectorParameter" skylineValues="0.0" typeSet="@typeSet"/>
68
+ <rhoSampling spec="TimedParameter" values="1" times="$(processLength)" typeSet="@typeSet"/>
69
+ </parameterization>
70
+ <startTypePriorProbs spec="RealParameter" value="$(startTypePriorProbs)"/>
71
+ </distribution>
72
+ </distribution>
73
+
74
+ <distribution id="prior" spec="CompoundDistribution">
75
+ <plate var="n" range="$(layersRange)">
76
+ <distribution spec="Prior" x="@birthRateW$(n)" distr="@weightsPrior"/>
77
+ <distribution spec="Prior" x="@deathRateW$(n)" distr="@weightsPrior"/>
78
+ </plate>
79
+ </distribution>
80
+ </distribution>
81
+
82
+ <plate var="n" range="$(layersRange)">
83
+ <operator spec="BactrianRandomWalkOperator" parameter="@birthRateW$(n)" weight="30.0"/>
84
+ <operator spec="BactrianRandomWalkOperator" parameter="@deathRateW$(n)" weight="30.0"/>
85
+ </plate>
86
+
87
+ <logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
88
+ <log idref="posterior"/>
89
+ <log idref="prior"/>
90
+ <log idref="likelihood"/>
91
+ <log idref="birthRateSP"/>
92
+ <log idref="deathRateSP"/>
93
+ <log idref="birthRate"/>
94
+ <log idref="deathRate"/>
95
+ </logger>
96
+ </run>
97
+
98
+ </beast>
@@ -0,0 +1,70 @@
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="Uniform">beast.base.inference.distribution.Uniform</map>
17
+
18
+ <map name="TreeFromNewickFile">feast.fileio.TreeFromNewickFile</map>
19
+ <map name="TaxonSetFromTree">feast.fileio.TaxonSetFromTree</map>
20
+ <map name="TraitSetFromTaxonSet">feast.fileio.TraitSetFromTaxonSet</map>
21
+ <map name="TypeSet">bdmmprime.parameterization.TypeSet</map>
22
+
23
+ <TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
24
+ <TaxonSetFromTree id="taxonSet" tree="@tree"/>
25
+ <TraitSetFromTaxonSet id="typeTraitSet" traitname="type" delimiter="|" takeGroup="1" taxa="@taxonSet"/>
26
+ <TypeSet id="typeSet" value="$(types)" typeTraitSet="@typeTraitSet"/>
27
+
28
+ <Uniform id="birthRatePrior" upper="$(birthRateUpper)"/>
29
+ <Uniform id="deathRatePrior" upper="$(deathRateUpper)"/>
30
+
31
+ <run spec="MCMC" chainLength="10000000">
32
+ <state id="state">
33
+ <stateNode spec="RealParameter" id="birthRate" value="$(birthRateInit)"/>
34
+ <stateNode spec="RealParameter" id="deathRate" value="$(deathRateInit)"/>
35
+ </state>
36
+
37
+ <distribution id="posterior" spec="CompoundDistribution">
38
+ <distribution id="likelihood" spec="CompoundDistribution">
39
+ <distribution spec="BirthDeathMigrationDistribution" tree="@tree" typeTraitSet="@typeTraitSet">
40
+ <parameterization spec="CanonicalParameterization" processLength="$(processLength)" typeSet="@typeSet">
41
+ <birthRate id="birthRateSP" spec="SkylineVectorParameter" skylineValues="@birthRate" changeTimes="$(changeTimes)" typeSet="@typeSet"/>
42
+ <deathRate id="deathRateSP" spec="SkylineVectorParameter" skylineValues="@deathRate" changeTimes="$(changeTimes)" typeSet="@typeSet"/>
43
+ <migrationRate spec="SkylineMatrixParameter" skylineValues="$(migrationRate)" typeSet="@typeSet"/>
44
+ <samplingRate spec="SkylineVectorParameter" skylineValues="$(samplingRate)" typeSet="@typeSet"/>
45
+ <removalProb spec="SkylineVectorParameter" skylineValues="0.0" typeSet="@typeSet"/>
46
+ <rhoSampling spec="TimedParameter" values="1" times="$(processLength)" typeSet="@typeSet"/>
47
+ </parameterization>
48
+ <startTypePriorProbs spec="RealParameter" value="$(startTypePriorProbs)"/>
49
+ </distribution>
50
+ </distribution>
51
+
52
+ <distribution id="prior" spec="CompoundDistribution">
53
+ <distribution spec="Prior" x="@deathRate" distr="@deathRatePrior"/>
54
+ <distribution spec="Prior" x="@birthRate" distr="@birthRatePrior"/>
55
+ </distribution>
56
+ </distribution>
57
+
58
+ <operator spec="BactrianScaleOperator" parameter="@birthRate" weight="30.0"/>
59
+ <operator spec="BactrianScaleOperator" parameter="@deathRate" 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="birthRateSP"/>
66
+ <log idref="deathRateSP"/>
67
+ </logger>
68
+ </run>
69
+
70
+ </beast>
@@ -0,0 +1,88 @@
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
+
21
+ <TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
22
+
23
+ <Normal id="weightsPrior" mean="0" sigma="1"/>
24
+ <Uniform id="birthRatePrior" upper="$(birthRateUpper)"/>
25
+ <Uniform id="deathRatePrior" upper="$(deathRateUpper)"/>
26
+
27
+ <run spec="MCMC" chainLength="10000000">
28
+ <state id="state">
29
+ <stateNode spec="RealParameter" id="birthRateScaler" value="1"/>
30
+ <stateNode spec="RealParameter" id="deathRateScaler" value="1"/>
31
+ <stateNode spec="RealParameter" id="birthRateW" value="0"/>
32
+ <stateNode spec="RealParameter" id="deathRateW" value="0"/>
33
+ </state>
34
+
35
+ <distribution id="posterior" spec="CompoundDistribution">
36
+ <distribution id="likelihood" spec="CompoundDistribution">
37
+ <distribution spec="BirthDeathMigrationDistribution" tree="@tree">
38
+ <parameterization spec="CanonicalParameterization" processLength="$(processLength)">
39
+ <birthRate id="birthRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)">
40
+ <skylineValues id="birthRate" spec="glmprior.util.GLMLogLinear" coefficients="@birthRateW" scaleFactor="@birthRateScaler" transform="false">
41
+ <predictor spec="RealParameter" value="$(timePredictor)"/>
42
+ <predictor spec="RealParameter" value="$(randomPredictor)"/>
43
+ <indicators spec="BooleanParameter" value="1"/>
44
+ </skylineValues>
45
+ </birthRate>
46
+ <deathRate id="deathRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)">
47
+ <skylineValues id="deathRate" spec="glmprior.util.GLMLogLinear" coefficients="@deathRateW" scaleFactor="@deathRateScaler" transform="false">
48
+ <predictor spec="RealParameter" value="$(timePredictor)"/>
49
+ <predictor spec="RealParameter" value="$(randomPredictor)"/>
50
+ <indicators spec="BooleanParameter" value="1"/>
51
+ </skylineValues>
52
+ </deathRate>
53
+ <samplingRate spec="SkylineVectorParameter" skylineValues="$(samplingRate)"/>
54
+ <removalProb spec="SkylineVectorParameter" skylineValues="0.0"/>
55
+ <rhoSampling spec="TimedParameter" values="1" times="$(processLength)"/>
56
+ </parameterization>
57
+ </distribution>
58
+ </distribution>
59
+
60
+ <distribution id="prior" spec="CompoundDistribution">
61
+ <distribution spec="Prior" x="@birthRateScaler" distr="@weightsPrior"/>
62
+ <distribution spec="Prior" x="@deathRateScaler" distr="@weightsPrior"/>
63
+ <distribution spec="Prior" x="@birthRateW" distr="@weightsPrior"/>
64
+ <distribution spec="Prior" x="@deathRateW" distr="@weightsPrior"/>
65
+ <distribution spec="Prior" x="@birthRate" distr="@birthRatePrior"/>
66
+ <distribution spec="Prior" x="@deathRate" distr="@deathRatePrior"/>
67
+ </distribution>
68
+ </distribution>
69
+
70
+ <operator spec="BactrianScaleOperator" parameter="@birthRateScaler" weight="30.0"/>
71
+ <operator spec="BactrianScaleOperator" parameter="@deathRateScaler" weight="30.0"/>
72
+ <operator spec="BactrianRandomWalkOperator" parameter="@birthRateW" weight="30.0"/>
73
+ <operator spec="BactrianRandomWalkOperator" parameter="@deathRateW" weight="30.0"/>
74
+
75
+ <logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
76
+ <log idref="posterior"/>
77
+ <log idref="prior"/>
78
+ <log idref="likelihood"/>
79
+ <log idref="birthRateSP"/>
80
+ <log idref="deathRateSP"/>
81
+ <log idref="birthRateW"/>
82
+ <log idref="deathRateW"/>
83
+ <log idref="birthRateScaler"/>
84
+ <log idref="deathRateScaler"/>
85
+ </logger>
86
+ </run>
87
+
88
+ </beast>
@@ -0,0 +1,86 @@
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
+
19
+ <TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
20
+
21
+ <Normal id="weightsPrior" mean="0" sigma="1"/>
22
+
23
+ <run spec="MCMC" chainLength="10000000">
24
+ <state id="state">
25
+ <plate var="n" range="$(layersRange)">
26
+ <stateNode spec="RealParameter" name="stateNode" id="birthRateW$(n)" value="0"/>
27
+ <stateNode spec="RealParameter" name="stateNode" id="deathRateW$(n)" value="0"/>
28
+ </plate>
29
+ </state>
30
+
31
+ <distribution id="posterior" spec="CompoundDistribution">
32
+ <distribution id="likelihood" spec="CompoundDistribution">
33
+ <distribution spec="BirthDeathMigrationDistribution" tree="@tree">
34
+ <parameterization spec="CanonicalParameterization" processLength="$(processLength)">
35
+ <birthRate id="birthRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)">
36
+ <skylineValues id="birthRate" spec="bella.BayesMLP" nodes="$(nodes)">
37
+ <predictor spec="RealParameter" value="$(timePredictor)"/>
38
+ <predictor spec="RealParameter" value="$(randomPredictor)"/>
39
+ <plate var="n" range="$(layersRange)">
40
+ <weights idref="birthRateW$(n)"/>
41
+ </plate>
42
+ <activationFunctionsOutput spec="bella.Sigmoid" upper="$(birthRateUpper)"/>
43
+ </skylineValues>
44
+ </birthRate>
45
+ <deathRate id="deathRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)">
46
+ <skylineValues id="deathRate" spec="bella.BayesMLP" nodes="$(nodes)">
47
+ <predictor spec="RealParameter" value="$(timePredictor)"/>
48
+ <predictor spec="RealParameter" value="$(randomPredictor)"/>
49
+ <plate var="n" range="$(layersRange)">
50
+ <weights idref="deathRateW$(n)"/>
51
+ </plate>
52
+ <activationFunctionsOutput spec="bella.Sigmoid" upper="$(deathRateUpper)"/>
53
+ </skylineValues>
54
+ </deathRate>
55
+ <samplingRate spec="SkylineVectorParameter" skylineValues="$(samplingRate)"/>
56
+ <removalProb spec="SkylineVectorParameter" skylineValues="0.0"/>
57
+ <rhoSampling spec="TimedParameter" values="1" times="$(processLength)"/>
58
+ </parameterization>
59
+ </distribution>
60
+ </distribution>
61
+
62
+ <distribution id="prior" spec="CompoundDistribution">
63
+ <plate var="n" range="$(layersRange)">
64
+ <distribution spec="Prior" x="@birthRateW$(n)" distr="@weightsPrior"/>
65
+ <distribution spec="Prior" x="@deathRateW$(n)" distr="@weightsPrior"/>
66
+ </plate>
67
+ </distribution>
68
+ </distribution>
69
+
70
+ <plate var="n" range="$(layersRange)">
71
+ <operator spec="BactrianRandomWalkOperator" parameter="@birthRateW$(n)" weight="30.0"/>
72
+ <operator spec="BactrianRandomWalkOperator" parameter="@deathRateW$(n)" weight="30.0"/>
73
+ </plate>
74
+
75
+ <logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
76
+ <log idref="posterior"/>
77
+ <log idref="prior"/>
78
+ <log idref="likelihood"/>
79
+ <log idref="birthRateSP"/>
80
+ <log idref="deathRateSP"/>
81
+ <log idref="birthRate"/>
82
+ <log idref="deathRate"/>
83
+ </logger>
84
+ </run>
85
+
86
+ </beast>
@@ -0,0 +1,62 @@
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="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
+ <Uniform id="birthRatePrior" upper="$(birthRateUpper)"/>
23
+ <Uniform id="deathRatePrior" upper="$(deathRateUpper)"/>
24
+
25
+ <run spec="MCMC" chainLength="10000000">
26
+ <state id="state">
27
+ <stateNode spec="RealParameter" id="birthRate" value="$(birthRateInit)"/>
28
+ <stateNode spec="RealParameter" id="deathRate" value="$(deathRateInit)"/>
29
+ </state>
30
+
31
+ <distribution id="posterior" spec="CompoundDistribution">
32
+ <distribution id="likelihood" spec="CompoundDistribution">
33
+ <distribution spec="BirthDeathMigrationDistribution" tree="@tree">
34
+ <parameterization spec="CanonicalParameterization" processLength="$(processLength)">
35
+ <birthRate id="birthRateSP" spec="SkylineVectorParameter" skylineValues="@birthRate" changeTimes="$(changeTimes)"/>
36
+ <deathRate id="deathRateSP" spec="SkylineVectorParameter" skylineValues="@deathRate" changeTimes="$(changeTimes)"/>
37
+ <samplingRate spec="SkylineVectorParameter" skylineValues="$(samplingRate)"/>
38
+ <removalProb spec="SkylineVectorParameter" skylineValues="0.0"/>
39
+ <rhoSampling spec="TimedParameter" values="1" times="$(processLength)"/>
40
+ </parameterization>
41
+ </distribution>
42
+ </distribution>
43
+
44
+ <distribution id="prior" spec="CompoundDistribution">
45
+ <distribution spec="Prior" x="@birthRate" distr="@birthRatePrior"/>
46
+ <distribution spec="Prior" x="@deathRate" distr="@deathRatePrior"/>
47
+ </distribution>
48
+ </distribution>
49
+
50
+ <operator spec="BactrianScaleOperator" parameter="@birthRate" weight="30.0"/>
51
+ <operator spec="BactrianScaleOperator" parameter="@deathRate" weight="30.0"/>
52
+
53
+ <logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
54
+ <log idref="posterior"/>
55
+ <log idref="prior"/>
56
+ <log idref="likelihood"/>
57
+ <log idref="birthRateSP"/>
58
+ <log idref="deathRateSP"/>
59
+ </logger>
60
+ </run>
61
+
62
+ </beast>
@@ -20,8 +20,8 @@ def generate_data():
20
20
  init_state=scenario.init_state,
21
21
  sampling_probability_at_present=int(scenario.type == ScenarioType.FBD),
22
22
  max_time=scenario.max_time,
23
- min_tips=MIN_TIPS,
24
- max_tips=MAX_TIPS,
25
23
  seed=42,
26
- n_jobs=2,
24
+ acceptance_criterion=lambda t: MIN_TIPS
25
+ <= sum(1 for l in t.get_leaves() if l.branch_length > 0) # pyright: ignore
26
+ <= MAX_TIPS,
27
27
  )
@@ -56,7 +56,3 @@ def print_metrics():
56
56
  }
57
57
  with open("simulation-metrics.json", "w") as f:
58
58
  json.dump(metrics, f)
59
-
60
-
61
- if __name__ == "__main__":
62
- print_metrics()
@@ -5,8 +5,7 @@ from glob import glob
5
5
  from pathlib import Path
6
6
 
7
7
  from numpy.random import default_rng
8
- from phylogenie import Tree, load_newick
9
- from phylogenie.utils import get_node_depths
8
+ from phylogenie import Tree, get_node_depths, load_newick
10
9
  from tqdm import tqdm
11
10
 
12
11
  from bella_companion.simulations.scenarios import SCENARIOS, ScenarioType
@@ -22,8 +21,10 @@ def run_beast():
22
21
  for scenario_name, scenario in SCENARIOS.items():
23
22
  job_ids[scenario_name] = defaultdict(dict)
24
23
  data_dir = base_data_dir / scenario_name
25
- inference_configs_dir = Path(os.environ["BELLA_BEAST_CONFIGS_DIR"]) / (
26
- scenario_name.split("_")[0] if "_" in scenario_name else scenario_name
24
+ inference_configs_dir = (
25
+ Path(__file__).parent
26
+ / "beast_configs"
27
+ / (scenario_name.split("_")[0] if "_" in scenario_name else scenario_name)
27
28
  )
28
29
  log_dir = Path(os.environ["BELLA_SBATCH_LOG_DIR"]) / scenario_name
29
30
  for tree_file in tqdm(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bella-companion
3
- Version: 0.0.14
3
+ Version: 0.0.16
4
4
  Summary:
5
5
  Author: gabriele-marino
6
6
  Author-email: gabmarino.8601@gmail.com
@@ -12,5 +12,5 @@ Classifier: Programming Language :: Python :: 3.12
12
12
  Requires-Dist: arviz (>=0.22.0,<0.23.0)
13
13
  Requires-Dist: bella-lumiere (>=0.0.14,<0.0.15)
14
14
  Requires-Dist: dotenv (>=0.9.9,<0.10.0)
15
- Requires-Dist: phylogenie (>=2.1.30,<3.0.0)
15
+ Requires-Dist: phylogenie (>=3.1.1,<4.0.0)
16
16
  Requires-Dist: seaborn (>=0.13.2,<0.14.0)
@@ -1,13 +1,26 @@
1
1
  bella_companion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bella_companion/cli.py,sha256=D-kQuj0I-g5Vm5-mXdOZoio68mhOBpJ3jVG8B2Kwvn4,2190
3
3
  bella_companion/fbd_empirical/__init__.py,sha256=FgzjaEpwZImvBsJs17ghF0ltZvhFmgmkTGGF3HgdsGo,284
4
+ bella_companion/fbd_empirical/beast_config.xml,sha256=McImvRgzYflbfCLQdo6sqTgvJcSDc8CQiRjDhgUWkFI,7075
4
5
  bella_companion/fbd_empirical/data/change_times.csv,sha256=tedobHbaY7-6M3V6F6HSqGAU9dpeeajR5mu1XGJfp6w,68
5
- bella_companion/fbd_empirical/data/traits.csv,sha256=cxNKYmgtBCKHsm9qnOpS29Rkx9cQKe0oxpgaXSIukJg,5422
6
- bella_companion/fbd_empirical/data/trees.nwk,sha256=JAsdfGhTIzGmJz6g6-0s5SVfqNuxawOMc9gbt0srue4,539385
7
- bella_companion/fbd_empirical/results.py,sha256=0FENY5EpgNQ6rwPsEiOT2ZEO5oBbIAK6TzPvk11SDnk,3116
8
- bella_companion/fbd_empirical/run_beast.py,sha256=daDuRgkVlXTZdjtoanNzgQpBw8uXv1D7hoivCnhLM6U,3265
9
- bella_companion/fbd_empirical/summarize_logs.py,sha256=OoT43DMjim9o4qsjYCgGKnBKp3dHXzVP6sVtzqR8lMQ,955
6
+ bella_companion/fbd_empirical/data/traits.csv,sha256=N_mCnaM9Gy0Qot7-l_mK0vMvr7e_5BZ4bgUHpcoG9UM,3949
7
+ bella_companion/fbd_empirical/data/trees.nwk,sha256=Y5ro7vQ8vz2Cp3kpNtOTRBfOdQAT-eJUwkb75x79bHE,539477
8
+ bella_companion/fbd_empirical/results.py,sha256=skf7PsdWZuOVkMeGgKsSCKDfho6tVWT7bUVFWTthxag,3114
9
+ bella_companion/fbd_empirical/run_beast.py,sha256=60t8tbqlgdv86JwBk_DvUQ8i7TpThz0EmwEv-OkBAQM,2560
10
+ bella_companion/fbd_empirical/summarize_logs.py,sha256=f3NgdyrCmbD5eHDHYwiA8ggh4b3rZ63SrlfDt0FAZmc,955
10
11
  bella_companion/simulations/__init__.py,sha256=ShYRdp1iSjnS_SzcsH-8jbqXz6P1nyRQZqAtPZJCMVE,454
12
+ bella_companion/simulations/beast_configs/epi-multitype/GLM.xml,sha256=VymAYsaZVuB3EPE0DCQSXpKepVq8pPjKaB5yhEpaVkE,4334
13
+ bella_companion/simulations/beast_configs/epi-multitype/MLP.xml,sha256=J-OVblMRmk4XRhz9DHhLpMwaIzqSqYZ7Yq7dTMvQW1s,4094
14
+ bella_companion/simulations/beast_configs/epi-multitype/Nonparametric.xml,sha256=DfCMcLM53b-XP9oIiQ9wJWOVTEP3GnoZaL5BMzLLfIQ,3208
15
+ bella_companion/simulations/beast_configs/epi-skyline/GLM.xml,sha256=7LtJhU7o7aQsnWK7ZIKj-mzmHgCn_RjxvKKbLIlp1Go,3619
16
+ bella_companion/simulations/beast_configs/epi-skyline/MLP.xml,sha256=ovjFleUnTgyrT8T1uaKboUsL-ZFLCaQN5mk4HadFPU0,3443
17
+ bella_companion/simulations/beast_configs/epi-skyline/Nonparametric.xml,sha256=LTiatqeAMiFfdD1leQ5TrGaJhsYwlkbMDpxqhVFOgUQ,2561
18
+ bella_companion/simulations/beast_configs/fbd-2traits/GLM.xml,sha256=Iff0eAShKLeOnlTmNu6044Wljtla3yckqo2LZ7mP6LY,5897
19
+ bella_companion/simulations/beast_configs/fbd-2traits/MLP.xml,sha256=E8sgfOAJI4rkbCVhGYa-HwM44ItwxVs4pIXkQOGNTtY,5462
20
+ bella_companion/simulations/beast_configs/fbd-2traits/Nonparametric.xml,sha256=ev6ZfMeCwMyK54G_4O8g-tbgoxoD3asxt71x91Cb1QY,3618
21
+ bella_companion/simulations/beast_configs/fbd-no-traits/GLM.xml,sha256=Caq7Gxqx-wYAu3_YkMikVqni3DjBv1Wt00sc1Upo1X8,4743
22
+ bella_companion/simulations/beast_configs/fbd-no-traits/MLP.xml,sha256=_EzDVPrU6Y5ZfzkVn---Sp62KeBZuRCZfoYqxblLq8I,4309
23
+ bella_companion/simulations/beast_configs/fbd-no-traits/Nonparametric.xml,sha256=m2xaHZwskCFInvVY1QH1fwQqH6p_fgESlPX2BbBeUhk,2822
11
24
  bella_companion/simulations/features.py,sha256=DZOBpJGlQ0UinqUZYbEtoemZ2eQGVLV_i-DfpW31qJI,104
12
25
  bella_companion/simulations/figures/__init__.py,sha256=aBYbJntH4egFmkSSWiVMYDEApXPYxJD7eA3TCPNNegM,658
13
26
  bella_companion/simulations/figures/epi_multitype_results.py,sha256=j85WgvN5AyAtX-CalMegr2lwlAZBmzyJxkikBPXRjCc,2629
@@ -19,10 +32,10 @@ bella_companion/simulations/figures/fbd_2traits_results.py,sha256=JiXrbYkH1HwdJQ
19
32
  bella_companion/simulations/figures/fbd_no_traits_results.py,sha256=fLsgpV3IbLLtxQEFNOL9K4jEEJrG324ziUM0rxIv7_k,1962
20
33
  bella_companion/simulations/figures/scenarios.py,sha256=gbMz1TUxxT2RSIq2kQlFioNdgSHk-gQY2OQuf6-7Fww,2817
21
34
  bella_companion/simulations/figures/utils.py,sha256=0M5OrxaEuqcj9rR2uAc_O7utQvhEceZGH0sKrGRWaWs,3129
22
- bella_companion/simulations/generate_data.py,sha256=ZFQnusmGWDjRixKOid0l49Aj4qfrI5zxyf1n21wf0p0,768
35
+ bella_companion/simulations/generate_data.py,sha256=edfhXrs76hl30i_xizup4z6qgzXZyaDzX_PVC62Ytpw,849
23
36
  bella_companion/simulations/generate_figures.py,sha256=layMgoj3Bfl78Ceb1oE7YirAQ8zhjDyD9IrxDRXf6go,657
24
- bella_companion/simulations/metrics.py,sha256=TwLgK4Eui4DlG10V9m6zEbmuGfUIli2dE0Ph-gX_6bU,1925
25
- bella_companion/simulations/run_beast.py,sha256=Sw9wKNe1VlGNvYr-yiYv3LqUYVlcjcMAz_9Pzr-xyL0,3214
37
+ bella_companion/simulations/metrics.py,sha256=duIkPb8cCXmIzjKA2yk9HLf4Y9eFIB_hRWaH05uIDws,1876
38
+ bella_companion/simulations/run_beast.py,sha256=qniy326i-vDCeHzzHpQRrSnY2ULqNNrO0z3GEsWx4Mc,3208
26
39
  bella_companion/simulations/scenarios/__init__.py,sha256=3Kl1lKcFpfb3vLX64DmSW4XCF5kXU1ZoHtstFH-ZIzU,876
27
40
  bella_companion/simulations/scenarios/common.py,sha256=_ddaSuTvEVdttGkXB4HPc2B7IB1F_GBOCW3cVOPZ-ZM,807
28
41
  bella_companion/simulations/scenarios/epi_multitype.py,sha256=fTkFeGHxyV_1f2nX3g_Oyr_e6wkorhXEicJjIAgeZKA,2439
@@ -35,7 +48,7 @@ bella_companion/utils/__init__.py,sha256=UtMwPK9dWf9NAl0ic8CSsgdW7aSm-5J49OqgvD7
35
48
  bella_companion/utils/beast.py,sha256=TBa0cLklX1_tXqoQE4LRYvds7mLg_9fS2-6U6OHENHo,2184
36
49
  bella_companion/utils/explain.py,sha256=uP7HPyn2YiykAI69BQV3RooDpC6qKoCLXfp3Uibp4zk,1475
37
50
  bella_companion/utils/slurm.py,sha256=v5DaG7YHVyK8KRFptgGDC6I8jxEhyJuMVK9N08pZSAI,1812
38
- bella_companion-0.0.14.dist-info/METADATA,sha256=TqkINLE8EFexOUFK0E1rNHoZHQgLgMsPZa7I_D2hGAI,577
39
- bella_companion-0.0.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
40
- bella_companion-0.0.14.dist-info/entry_points.txt,sha256=rSeKoAhmjnQqAYFcXBv0gAM2ViJfJe0D8_dD-fWrXeg,50
41
- bella_companion-0.0.14.dist-info/RECORD,,
51
+ bella_companion-0.0.16.dist-info/METADATA,sha256=Kd_M6fOFsQ9v3Ph7_saJZp3_GGZHfGC88-0Uk3UPJS8,576
52
+ bella_companion-0.0.16.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
53
+ bella_companion-0.0.16.dist-info/entry_points.txt,sha256=rSeKoAhmjnQqAYFcXBv0gAM2ViJfJe0D8_dD-fWrXeg,50
54
+ bella_companion-0.0.16.dist-info/RECORD,,