Package pal.xml
Class ElementParser
java.lang.Object
pal.xml.ElementParser
- All Implemented Interfaces:
XMLConstants
This class provides static methods for parsing PAL objects
from DOM Elements. Methods are ordered in public, protected, private and
alphabetic within each group.
- Version:
- $Id: ElementParser.java,v 1.14 2003/08/02 01:15:14 matt Exp $
- Author:
- Alexei Drummond
-
Field Summary
Fields inherited from interface pal.util.XMLConstants
A_TO_C, A_TO_G, A_TO_T, ALIGNMENT, ALPHA, ANCESTRAL_MU_RATE, ANCESTRAL_POP_SIZE, ATTRIBUTE, BACKWARDS, BLOSUM62, C_TO_G, C_TO_T, COALESCENT, CONST_EXP_CONST, CONST_EXP_GROWTH, CONSTANT_MUTATION_RATE, CONSTANT_POPULATION, CPREV, CURRENT_POP_SIZE_DURATION, DATA_TYPE, DATA_TYPE_ID, DAYHOFF, DAYS, DEMOGRAPHIC_MODEL, DIRECTION, EDGE, EXPANDING_POPULATION, EXPONENTIAL_GROWTH, F81, F84, FREQUENCIES, G_TO_T, GAMMA_ALPHA, GAMMA_DISTRIBUTION, GENERATIONS, GROWTH_PHASE_DURATION, GROWTH_RATE, GTR, HEIGHT, HKY, ID, JC, JTT, KAPPA, LENGTH, MISSING, MODEL, MONTHS, MTREV24, MU_STEP_TIME, MUTATION_RATE, MUTATION_RATE_MODEL, MUTATIONS, NAME, NODE, NUMBER_CATEGORIES, OMEGA, ORIGIN, PARAMETER, POPULATION_SIZE, PYRIMIDINE_PURINE_RATIO, RATE_DISTRIBUTION, RATE_MATRIX, SEQUENCE, SPACES_PER_LEVEL, STEPPED_MUTATION_RATE, TIME, TIME_DATA, TN, TREE, TS_TV_RATIO, TWO_STATE, TYPE, UNIFORM, UNIFORM_RATE_DISTRIBUTION, UNITS, UNKNOWN, VALUE, VT, WAG, YANG_CODON_MODEL, YEARS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static double
static Element
getFirstByName
(Element parent, String name) protected static int
protected static String
protected static int
protected static final boolean
hasAttribute
(Element e, String name) This method allows the removeal of e.hasAttribute which is DOM Level 2.static Alignment
Parses an alignment element and returns an alignment object.static Attribute
parses an attribute element.static DemographicModel
Parses an element from an DOM document into a DemographicModel.static Node
static final double[]
parseFrequencies
(Element element) reads XML format of frequencies.static MutationRateModel
Reads a mutation rate model from a DOM Document element.static Node
static RateDistribution
static RateMatrix
Reads a rate matrix from a DOM Document element.protected static RateMatrix
parseRateMatrix
(Element e, Alignment a) Reads a rate matrix from a DOM Document element.static TimeOrderCharacterData
static Tree
static void
validateTagName
(Element e, String name) Throws a runtime exception if the element does not have the given name.
-
Constructor Details
-
ElementParser
public ElementParser()
-
-
Method Details
-
getFirstByName
- Returns:
- the first child element of the given name.
-
parseAlignmentElement
Parses an alignment element and returns an alignment object.- Throws:
XmlParseException
-
parseAttributeElement
parses an attribute element.- Throws:
XmlParseException
-
parseDemographicModel
Parses an element from an DOM document into a DemographicModel. Recognises ConstantPopulation, ExponentialGrowth, ConstExpGrowth.- Throws:
XmlParseException
-
parseEdgeNodeElement
- Returns:
- a tree node parsed from an XML element.
- Throws:
XmlParseException
-
parseFrequencies
reads XML format of frequencies.
e.g <frequencies>0.19 0.31 0.16 0.34 </frequencies>.- Throws:
XmlParseException
-
parseMutationRateModel
Reads a mutation rate model from a DOM Document element.- Throws:
XmlParseException
-
parseNodeElement
- Returns:
- a tree node parsed from an XML element.
- Throws:
XmlParseException
-
parseRateMatrix
Reads a rate matrix from a DOM Document element. Reads JC, F81, HKY, GTR- Throws:
XmlParseException
-
parseRateDistribution
- Throws:
XmlParseException
-
parseRateMatrix
Reads a rate matrix from a DOM Document element. Reads JC, F81, HKY, GTR- Throws:
XmlParseException
-
parseTimeDataElement
- Returns:
- a time data object based on the given XML element.
- Throws:
XmlParseException
-
parseTreeElement
- Returns:
- a tree object based on the XML element it was passed.
- Throws:
XmlParseException
-
validateTagName
Throws a runtime exception if the element does not have the given name.- Throws:
XmlParseException
-
getDoubleValue
-
getIntegerValue
-
getNameAttr
-
getUnitsAttr
-
hasAttribute
This method allows the removeal of e.hasAttribute which is DOM Level 2. I am trying to keep compliant with DOM level 1 for now.
-