| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.evomodel.coalescent; |
| 27 |
|
| 28 |
import dr.evolution.coalescent.DemographicFunction; |
| 29 |
import dr.evolution.coalescent.ExponentialLogistic; |
| 30 |
import dr.evomodelxml.coalescent.ExponentialLogisticModelParser; |
| 31 |
import dr.inference.model.Parameter; |
| 32 |
import dr.util.Author; |
| 33 |
import dr.util.Citable; |
| 34 |
import dr.util.Citation; |
| 35 |
|
| 36 |
import java.util.Collections; |
| 37 |
import java.util.List; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
public class ExponentialLogisticModel extends DemographicModel implements Citable { |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
public ExponentialLogisticModel(Parameter N0Parameter, |
| 56 |
Parameter logisticGrowthParameter, |
| 57 |
Parameter logisticShapeParameter, |
| 58 |
Parameter exponentialGrowthParameter, |
| 59 |
Parameter transitionTimeParameter, |
| 60 |
double alpha, Type units) { |
| 61 |
|
| 62 |
this(ExponentialLogisticModelParser.EXPONENTIAL_LOGISTIC_MODEL, |
| 63 |
N0Parameter, |
| 64 |
logisticGrowthParameter, |
| 65 |
logisticShapeParameter, |
| 66 |
exponentialGrowthParameter, |
| 67 |
transitionTimeParameter, |
| 68 |
alpha, units); |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
public ExponentialLogisticModel(String name, Parameter N0Parameter, |
| 75 |
Parameter logisticGrowthParameter, |
| 76 |
Parameter logisticShapeParameter, |
| 77 |
Parameter exponentialGrowthParameter, |
| 78 |
Parameter transistionTimeParameter, |
| 79 |
double alpha, Type units) { |
| 80 |
|
| 81 |
super(name); |
| 82 |
|
| 83 |
exponentialLogistic = new ExponentialLogistic(units); |
| 84 |
|
| 85 |
this.N0Parameter = N0Parameter; |
| 86 |
addVariable(N0Parameter); |
| 87 |
N0Parameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1)); |
| 88 |
|
| 89 |
this.logisticGrowthParameter = logisticGrowthParameter; |
| 90 |
addVariable(logisticGrowthParameter); |
| 91 |
logisticGrowthParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1)); |
| 92 |
|
| 93 |
this.logisticShapeParameter = logisticShapeParameter; |
| 94 |
addVariable(logisticShapeParameter); |
| 95 |
logisticShapeParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1)); |
| 96 |
|
| 97 |
this.exponentialGrowthParameter = exponentialGrowthParameter; |
| 98 |
addVariable(exponentialGrowthParameter); |
| 99 |
exponentialGrowthParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1)); |
| 100 |
|
| 101 |
this.transistionTimeParameter = transistionTimeParameter; |
| 102 |
addVariable(transistionTimeParameter); |
| 103 |
transistionTimeParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1)); |
| 104 |
|
| 105 |
this.alpha = alpha; |
| 106 |
|
| 107 |
setUnits(units); |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
public DemographicFunction getDemographicFunction() { |
| 114 |
exponentialLogistic.setN0(N0Parameter.getParameterValue(0)); |
| 115 |
|
| 116 |
double r = logisticGrowthParameter.getParameterValue(0); |
| 117 |
exponentialLogistic.setGrowthRate(r); |
| 118 |
|
| 119 |
double r1 = exponentialGrowthParameter.getParameterValue(0); |
| 120 |
exponentialLogistic.setR1(r1); |
| 121 |
|
| 122 |
double t = transistionTimeParameter.getParameterValue(0); |
| 123 |
exponentialLogistic.setTime(t); |
| 124 |
|
| 125 |
|
| 126 |
exponentialLogistic.setTime50(logisticShapeParameter.getParameterValue(0)); |
| 127 |
|
| 128 |
|
| 129 |
return exponentialLogistic; |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
Parameter N0Parameter = null; |
| 137 |
Parameter logisticGrowthParameter = null; |
| 138 |
Parameter logisticShapeParameter = null; |
| 139 |
Parameter exponentialGrowthParameter = null; |
| 140 |
Parameter transistionTimeParameter = null; |
| 141 |
double alpha = 0.5; |
| 142 |
ExponentialLogistic exponentialLogistic = null; |
| 143 |
|
| 144 |
@Override |
| 145 |
public Citation.Category getCategory() { |
| 146 |
return Citation.Category.TREE_PRIORS; |
| 147 |
} |
| 148 |
|
| 149 |
@Override |
| 150 |
public String getDescription() { |
| 151 |
return "Exponential-Logistic Coalescent"; |
| 152 |
} |
| 153 |
|
| 154 |
@Override |
| 155 |
public List<Citation> getCitations() { |
| 156 |
return Collections.singletonList(CITATION); |
| 157 |
} |
| 158 |
|
| 159 |
public static Citation CITATION = new Citation( |
| 160 |
new Author[]{ |
| 161 |
new Author("OG", "Pybus"), |
| 162 |
new Author("A", "Rambaut") |
| 163 |
}, |
| 164 |
"GENIE: estimating demographic history from molecular phylogenies", |
| 165 |
2001, |
| 166 |
"Bioinformatics", |
| 167 |
18, 1404, 1405 |
| 168 |
); |
| 169 |
} |