| 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.epidemiology.casetocase; |
| 27 |
|
| 28 |
import dr.evomodelxml.tree.TreeLoggerParser; |
| 29 |
import dr.xml.ElementRule; |
| 30 |
import dr.xml.XMLObject; |
| 31 |
import dr.xml.XMLParseException; |
| 32 |
import dr.xml.XMLSyntaxRule; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public class PartitionedTreeLoggerParser extends TreeLoggerParser { |
| 39 |
|
| 40 |
private XMLSyntaxRule[] rules; |
| 41 |
|
| 42 |
public PartitionedTreeLoggerParser(){ |
| 43 |
rules = new XMLSyntaxRule[super.getSyntaxRules().length + 1]; |
| 44 |
System.arraycopy(super.getSyntaxRules(), 0, rules, 0, rules.length-1); |
| 45 |
rules[rules.length-1] = new ElementRule(CaseToCaseTreeLikelihood.class); |
| 46 |
} |
| 47 |
public String getParserName() { |
| 48 |
return "logPartitionedTree"; |
| 49 |
} |
| 50 |
|
| 51 |
public String getParserDescription() { |
| 52 |
return "Logs a partitioned tree (phylogenetic tree and transmission tree)"; |
| 53 |
} |
| 54 |
|
| 55 |
public Class getReturnType() { |
| 56 |
return PartitionedTreeLogger.class; |
| 57 |
} |
| 58 |
|
| 59 |
public XMLSyntaxRule[] getSyntaxRules() { |
| 60 |
return this.rules; |
| 61 |
} |
| 62 |
|
| 63 |
public Object parseXMLObject(XMLObject xo) throws XMLParseException { |
| 64 |
parseXMLParameters(xo); |
| 65 |
CaseToCaseTreeLikelihood c2cTL = (CaseToCaseTreeLikelihood)xo.getChild(CaseToCaseTreeLikelihood.class); |
| 66 |
|
| 67 |
PartitionedTreeLogger logger = new PartitionedTreeLogger(c2cTL, tree, branchRates, |
| 68 |
treeAttributeProviders, treeTraitProviders, |
| 69 |
formatter, logEvery, nexusFormat, sortTranslationTable, mapNames, format, condition); |
| 70 |
|
| 71 |
if (title != null) { |
| 72 |
logger.setTitle(title); |
| 73 |
} |
| 74 |
|
| 75 |
return logger; |
| 76 |
} |
| 77 |
} |
| 78 |
|