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);
}
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);
}
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);
}
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");
}
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");
}
}
}
}
}
Aggregations