| 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.indel; |
| 27 |
|
| 28 |
import dr.evolution.alignment.Alignment; |
| 29 |
import dr.oldevomodel.indel.TKF91Likelihood; |
| 30 |
import dr.oldevomodel.indel.TKF91Model; |
| 31 |
import dr.oldevomodel.sitemodel.GammaSiteModel; |
| 32 |
import dr.evomodel.tree.TreeModel; |
| 33 |
import dr.xml.*; |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public class TKF91LikelihoodParser extends AbstractXMLObjectParser { |
| 39 |
|
| 40 |
public static final String TKF91_LIKELIHOOD = "tkf91Likelihood"; |
| 41 |
public static final String TKF91_DEATH = "deathRate"; |
| 42 |
|
| 43 |
|
| 44 |
public String getParserName() { |
| 45 |
return TKF91_LIKELIHOOD; |
| 46 |
} |
| 47 |
|
| 48 |
public Object parseXMLObject(XMLObject xo) throws XMLParseException { |
| 49 |
|
| 50 |
TreeModel tree = (TreeModel) xo.getChild(TreeModel.class); |
| 51 |
Alignment alignment = (Alignment) xo.getChild(Alignment.class); |
| 52 |
GammaSiteModel siteModel = (GammaSiteModel) xo.getChild(GammaSiteModel.class); |
| 53 |
TKF91Model tkfModel = (TKF91Model) xo.getChild(TKF91Model.class); |
| 54 |
return new TKF91Likelihood(tree, alignment, siteModel, tkfModel); |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
public String getParserDescription() { |
| 62 |
return "Returns the total likelihood of a single alignment under the TKF91 model, for a given tree. " + |
| 63 |
"In particular all possible ancestral histories of insertions and deletions leading to the " + |
| 64 |
"alignment of sequences at the tips are taken into account."; |
| 65 |
} |
| 66 |
|
| 67 |
public Class getReturnType() { |
| 68 |
return TKF91Likelihood.class; |
| 69 |
} |
| 70 |
|
| 71 |
public XMLSyntaxRule[] getSyntaxRules() { |
| 72 |
return rules; |
| 73 |
} |
| 74 |
|
| 75 |
private final XMLSyntaxRule[] rules = { |
| 76 |
new ElementRule(TreeModel.class), |
| 77 |
new ElementRule(Alignment.class), |
| 78 |
new ElementRule(GammaSiteModel.class), |
| 79 |
new ElementRule(TKF91Model.class) |
| 80 |
}; |
| 81 |
} |