Search in sources :

Example 1 with HypermutantAlignment

use of dr.evolution.alignment.HypermutantAlignment in project beast-mcmc by beast-dev.

the class HypermutantAlignmentParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Alignment alignment = (Alignment) xo.getChild(Alignment.class);
    if (alignment.getDataType().getType() != DataType.NUCLEOTIDES) {
        throw new XMLParseException("HypermutantAlignment can only convert nucleotide alignments");
    }
    String typeName = xo.getStringAttribute(CONTEXT_TYPE);
    HypermutantAlignment.APOBECType type = null;
    try {
        type = HypermutantAlignment.APOBECType.valueOf(typeName.toUpperCase());
    } catch (IllegalArgumentException iae) {
        throw new XMLParseException("Unrecognised hypermutation type: " + typeName);
    }
    HypermutantAlignment convert = new HypermutantAlignment(type, alignment);
    int mutatedCount = convert.getMutatedContextCount();
    int totalCount = mutatedCount + convert.getUnmutatedContextCount();
    Logger.getLogger("dr.evoxml").info("Converted alignment, '" + xo.getId() + "' to a hypermutant alignment targeting " + type.toString() + " contexts.\r" + "\tPotentially mutated contexts: " + mutatedCount + " out of a total of " + totalCount + " contexts");
    return convert;
}
Also used : Alignment(dr.evolution.alignment.Alignment) HypermutantAlignment(dr.evolution.alignment.HypermutantAlignment) HypermutantAlignment(dr.evolution.alignment.HypermutantAlignment)

Aggregations

Alignment (dr.evolution.alignment.Alignment)1 HypermutantAlignment (dr.evolution.alignment.HypermutantAlignment)1