Search in sources :

Example 11 with PartitionSubstitutionModel

use of dr.app.beauti.options.PartitionSubstitutionModel in project beast-mcmc by beast-dev.

the class BeautiTesterConfig method buildAAModels.

public void buildAAModels(String key, BeautiOptions beautiOptions) {
    PartitionSubstitutionModel model = beautiOptions.getPartitionSubstitutionModels().get(0);
    model.setAaSubstitutionModel(AminoAcidModelType.BLOSUM_62);
    buildHeteroModels(key + "BLOSUM62", beautiOptions);
    model.setAaSubstitutionModel(AminoAcidModelType.CP_REV_45);
    buildHeteroModels(key + "CPREV45", beautiOptions);
    model.setAaSubstitutionModel(AminoAcidModelType.DAYHOFF);
    buildHeteroModels(key + "DAYHOFF", beautiOptions);
    model.setAaSubstitutionModel(AminoAcidModelType.JTT);
    buildHeteroModels(key + "JTT", beautiOptions);
    model.setAaSubstitutionModel(AminoAcidModelType.MT_REV_24);
    buildHeteroModels(key + "MTREV24", beautiOptions);
    model.setAaSubstitutionModel(AminoAcidModelType.WAG);
    buildHeteroModels(key + "WAG", beautiOptions);
    model.setAaSubstitutionModel(AminoAcidModelType.LG);
    buildHeteroModels(key + "LG", beautiOptions);
}
Also used : PartitionSubstitutionModel(dr.app.beauti.options.PartitionSubstitutionModel)

Example 12 with PartitionSubstitutionModel

use of dr.app.beauti.options.PartitionSubstitutionModel in project beast-mcmc by beast-dev.

the class BeautiTesterConfig method buildNucModels.

public void buildNucModels(String key, BeautiOptions beautiOptions) {
    PartitionSubstitutionModel model = beautiOptions.getPartitionSubstitutionModels().get(0);
    model.setNucSubstitutionModel(NucModelType.HKY);
    buildCodonModels(key + "HKY", beautiOptions);
    model.setNucSubstitutionModel(NucModelType.GTR);
    buildCodonModels(key + "GTR", beautiOptions);
}
Also used : PartitionSubstitutionModel(dr.app.beauti.options.PartitionSubstitutionModel)

Example 13 with PartitionSubstitutionModel

use of dr.app.beauti.options.PartitionSubstitutionModel in project beast-mcmc by beast-dev.

the class AncestralStatesComponentGenerator method writeCountingParameter.

// END: generate
private void writeCountingParameter(XMLWriter writer, AbstractPartitionData partition, String prefix) {
    AncestralStatesComponentOptions component = (AncestralStatesComponentOptions) options.getComponentOptions(AncestralStatesComponentOptions.class);
    if (!component.isCountingStates(partition)) {
        return;
    }
    StringBuilder matrix = new StringBuilder();
    DataType dataType = partition.getDataType();
    int stateCount = dataType.getStateCount();
    if (dataType.getType() == DataType.GENERAL) {
        PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel();
        stateCount = substModel.getDiscreteStateSet().size();
    }
    for (int i = 0; i < stateCount; i++) {
        for (int j = 0; j < stateCount; j++) {
            if (i == j) {
                matrix.append(" 0.0");
            } else {
                matrix.append(" 1.0");
            }
        }
    }
    writer.writeTag("parameter", new Attribute[] { new Attribute.Default<String>("id", partition.getPrefix() + "count"), new Attribute.Default<String>("value", matrix.toString()) }, true);
}
Also used : Attribute(dr.util.Attribute) DataType(dr.evolution.datatype.DataType) PartitionSubstitutionModel(dr.app.beauti.options.PartitionSubstitutionModel)

Example 14 with PartitionSubstitutionModel

use of dr.app.beauti.options.PartitionSubstitutionModel in project beast-mcmc by beast-dev.

the class AncestralStatesComponentGenerator method writeStateLogger.

private void writeStateLogger(XMLWriter writer, AbstractPartitionData partition, String mrcaId) {
    writer.writeComment("Ancestral state reconstruction for: " + partition.getName());
    writer.writeOpenTag("log", new Attribute[] { new Attribute.Default<String>("id", "fileLog_" + partition.getName()), new Attribute.Default<String>("logEvery", Integer.toString(options.logEvery)), new Attribute.Default<String>("fileName", options.fileNameStem + "." + partition.getName() + STATE_LOG_SUFFIX) });
    PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel();
    int cpCount = partition.getPartitionSubstitutionModel().getCodonPartitionCount();
    if (cpCount > 1) {
        for (int i = 1; i <= substModel.getCodonPartitionCount(); i++) {
            String prefix = partition.getPrefix() + substModel.getPrefixCodon(i);
            String name = partition.getName() + "." + substModel.getPrefixCodon(i);
            if (name.endsWith(".")) {
                name = name.substring(0, name.length() - 1);
            }
            writeAncestralTrait(writer, partition, mrcaId, prefix, name);
        }
    } else {
        writeAncestralTrait(writer, partition, mrcaId, partition.getPrefix(), partition.getName());
    }
    writer.writeCloseTag("log");
}
Also used : Attribute(dr.util.Attribute) PartitionSubstitutionModel(dr.app.beauti.options.PartitionSubstitutionModel)

Example 15 with PartitionSubstitutionModel

use of dr.app.beauti.options.PartitionSubstitutionModel in project beast-mcmc by beast-dev.

the class AncestralStatesComponentGenerator method writeTreeLogs.

private void writeTreeLogs(XMLWriter writer, AncestralStatesComponentOptions component, PartitionTreeModel treeModel) {
    for (AbstractPartitionData partition : options.getDataPartitions()) {
        if (partition.getPartitionTreeModel() == treeModel) {
            if (component.dNdSRobustCounting(partition)) {
                String prefix = partition.getName() + ".";
                writer.writeIDref("codonPartitionedRobustCounting", prefix + "robustCounting1");
                writer.writeIDref("codonPartitionedRobustCounting", prefix + "robustCounting2");
            }
            if (component.reconstructAtNodes(partition)) {
                // is an alignment data partition
                PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel();
                int cpCount = partition.getPartitionSubstitutionModel().getCodonPartitionCount();
                if (cpCount > 1) {
                    for (int i = 1; i <= substModel.getCodonPartitionCount(); i++) {
                        String prefix = partition.getPrefix() + substModel.getPrefixCodon(i);
                        String name = partition.getName() + "." + substModel.getPrefixCodon(i);
                        if (name.endsWith(".")) {
                            name = name.substring(0, name.length() - 1);
                        }
                        writeTrait(writer, partition, prefix, AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG, name);
                    }
                } else {
                    writeTrait(writer, partition, partition.getPrefix(), AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG, partition.getName());
                }
            }
            if (component.isCountingStates(partition)) {
                if (partition.getDataType().getType() == DataType.CONTINUOUS) {
                    throw new RuntimeException("Can't do counting on Continuous data partition");
                }
                PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel();
                int cpCount = partition.getPartitionSubstitutionModel().getCodonPartitionCount();
                if (cpCount > 1) {
                    for (int i = 1; i <= substModel.getCodonPartitionCount(); i++) {
                        String prefix = partition.getPrefix() + substModel.getPrefixCodon(i);
                        String name = partition.getName() + "." + substModel.getPrefixCodon(i) + "count";
                        writeTrait(writer, partition, prefix, "count", name);
                    }
                } else {
                    writeTrait(writer, partition, partition.getPrefix(), "count", partition.getName() + ".count");
                }
            }
        }
    }
}
Also used : AbstractPartitionData(dr.app.beauti.options.AbstractPartitionData) PartitionSubstitutionModel(dr.app.beauti.options.PartitionSubstitutionModel)

Aggregations

PartitionSubstitutionModel (dr.app.beauti.options.PartitionSubstitutionModel)17 Attribute (dr.util.Attribute)4 DataType (dr.evolution.datatype.DataType)3 AncestralStatesComponentOptions (dr.app.beauti.components.ancestralstates.AncestralStatesComponentOptions)1 SequenceErrorModelComponentOptions (dr.app.beauti.components.sequenceerror.SequenceErrorModelComponentOptions)1 AbstractPartitionData (dr.app.beauti.options.AbstractPartitionData)1 PartitionData (dr.app.beauti.options.PartitionData)1 NexusApplicationImporter (dr.app.beauti.util.NexusApplicationImporter)1 Alignment (dr.evolution.alignment.Alignment)1 CharSetAlignment (dr.evolution.alignment.CharSetAlignment)1 ConvertAlignment (dr.evolution.alignment.ConvertAlignment)1 Patterns (dr.evolution.alignment.Patterns)1 SitePatterns (dr.evolution.alignment.SitePatterns)1 Microsatellite (dr.evolution.datatype.Microsatellite)1 Importer (dr.evolution.io.Importer)1 NexusImporter (dr.evolution.io.NexusImporter)1 Tree (dr.evolution.tree.Tree)1 dr.evolution.util (dr.evolution.util)1 ArrayList (java.util.ArrayList)1 EmptyBorder (javax.swing.border.EmptyBorder)1