Debian Codegraph @

src/dr/oldevomodelxml/indel/TKF91LikelihoodParser.java

raw symbols SCIP
1 /*
2 * TKF91LikelihoodParser.java
3 *
4 * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
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 //public static final String MU = "mutationRate";
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 // AbstractXMLObjectParser implementation
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 }