| 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.oldevomodelxml.treelikelihood; |
| 27 |
|
| 28 |
import dr.evomodel.branchratemodel.BranchRateModel; |
| 29 |
import dr.evomodel.branchratemodel.StrictClockBranchRates; |
| 30 |
import dr.oldevomodel.substmodel.MicrosatelliteModel; |
| 31 |
import dr.evomodel.tree.MicrosatelliteSamplerTreeModel; |
| 32 |
import dr.oldevomodel.treelikelihood.MicrosatelliteSamplerTreeLikelihood; |
| 33 |
import dr.inference.model.Parameter; |
| 34 |
import dr.xml.*; |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
@Deprecated |
| 42 |
public class MicrosatelliteSamplerTreeLikelihoodParser extends AbstractXMLObjectParser { |
| 43 |
public static final String TREE_LIKELIHOOD = "microsatelliteSamplerTreeLikelihood"; |
| 44 |
public static final String MUTATION_RATE = "mutationRate"; |
| 45 |
public static final String BRANCH_RATE_MODEL = "branchRateModel"; |
| 46 |
public String getParserName(){ |
| 47 |
return TREE_LIKELIHOOD; |
| 48 |
} |
| 49 |
|
| 50 |
public XMLSyntaxRule[] getSyntaxRules() { |
| 51 |
return rules; |
| 52 |
} |
| 53 |
|
| 54 |
public Object parseXMLObject(XMLObject xo) throws XMLParseException { |
| 55 |
MicrosatelliteSamplerTreeModel mstModel = (MicrosatelliteSamplerTreeModel)xo.getChild(MicrosatelliteSamplerTreeModel.class); |
| 56 |
MicrosatelliteModel microsatelliteModel = (MicrosatelliteModel)xo.getChild(MicrosatelliteModel.class); |
| 57 |
|
| 58 |
BranchRateModel branchRateModel; |
| 59 |
Object cxo = xo.getChild(BranchRateModel.class); |
| 60 |
|
| 61 |
if(xo.getChild(BranchRateModel.class) !=null){ |
| 62 |
|
| 63 |
branchRateModel = (BranchRateModel)cxo; |
| 64 |
System.out.println("BranchRateModel provided to MicrosatelliteSamplerTreeLikelihood"); |
| 65 |
|
| 66 |
}else if(xo.hasChildNamed(MUTATION_RATE)){ |
| 67 |
|
| 68 |
Parameter muRate = (Parameter)xo.getElementFirstChild(MUTATION_RATE); |
| 69 |
branchRateModel = new StrictClockBranchRates(muRate); |
| 70 |
System.out.println("mutation rate provided to MicrosatelliteSamplerTreeLikelihood"); |
| 71 |
|
| 72 |
}else{ |
| 73 |
branchRateModel = new StrictClockBranchRates(new Parameter.Default(1.0)); |
| 74 |
} |
| 75 |
|
| 76 |
return new MicrosatelliteSamplerTreeLikelihood(mstModel,microsatelliteModel, branchRateModel); |
| 77 |
} |
| 78 |
|
| 79 |
private final XMLSyntaxRule[] rules = { |
| 80 |
new ElementRule(MicrosatelliteSamplerTreeModel.class), |
| 81 |
new ElementRule(MicrosatelliteModel.class), |
| 82 |
new ElementRule(MUTATION_RATE, new XMLSyntaxRule[]{new ElementRule(Parameter.class)},true), |
| 83 |
new ElementRule(BranchRateModel.class,true) |
| 84 |
}; |
| 85 |
|
| 86 |
public String getParserDescription(){ |
| 87 |
return "this parser returns an object of the TreeMicrosatelliteSamplerLikelihood class"; |
| 88 |
} |
| 89 |
|
| 90 |
public Class getReturnType(){ |
| 91 |
return MicrosatelliteSamplerTreeLikelihood.class; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
} |