| 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.app.beauti.components.ancestralstates; |
| 27 |
|
| 28 |
import dr.app.beauti.generator.BaseComponentGenerator; |
| 29 |
import dr.app.beauti.generator.ComponentGenerator; |
| 30 |
import dr.app.beauti.options.*; |
| 31 |
import dr.app.beauti.util.XMLWriter; |
| 32 |
import dr.evolution.datatype.DataType; |
| 33 |
import dr.evomodel.tree.TreeModel; |
| 34 |
import dr.evomodelxml.tree.TreeLoggerParser; |
| 35 |
import dr.evomodelxml.treelikelihood.MarkovJumpsTreeLikelihoodParser; |
| 36 |
import dr.inferencexml.model.CompoundLikelihoodParser; |
| 37 |
import dr.oldevomodelxml.treelikelihood.AncestralStateTreeLikelihoodParser; |
| 38 |
import dr.util.Attribute; |
| 39 |
import dr.xml.XMLParser; |
| 40 |
|
| 41 |
import java.util.ArrayList; |
| 42 |
import java.util.List; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public class AncestralStatesComponentGenerator extends BaseComponentGenerator { |
| 49 |
|
| 50 |
private final static boolean DEBUG = true; |
| 51 |
|
| 52 |
private final static String DNDS_LOG_SUFFIX = ".dNdS.log"; |
| 53 |
private final static String STATE_LOG_SUFFIX = ".states.log"; |
| 54 |
|
| 55 |
public AncestralStatesComponentGenerator(final BeautiOptions options) { |
| 56 |
super(options); |
| 57 |
} |
| 58 |
|
| 59 |
public boolean usesInsertionPoint(InsertionPoint point) { |
| 60 |
|
| 61 |
AncestralStatesComponentOptions component = (AncestralStatesComponentOptions) options |
| 62 |
.getComponentOptions(AncestralStatesComponentOptions.class); |
| 63 |
|
| 64 |
boolean reconstructAtNodes = false; |
| 65 |
boolean reconstructAtMRCA = false; |
| 66 |
boolean countingStates = false; |
| 67 |
boolean dNdSRobustCounting = false; |
| 68 |
boolean completeHistory = false; |
| 69 |
|
| 70 |
for (AbstractPartitionData partition : options.getDataPartitions()) { |
| 71 |
if (component.reconstructAtNodes(partition)) reconstructAtNodes = true; |
| 72 |
if (component.reconstructAtMRCA(partition)) reconstructAtMRCA = true; |
| 73 |
if (component.isCountingStates(partition)) countingStates = true; |
| 74 |
if (component.dNdSRobustCounting(partition)) dNdSRobustCounting = true; |
| 75 |
if (component.isCountingStates(partition) && component.isCompleteHistoryLogging(partition)) completeHistory = true; |
| 76 |
} |
| 77 |
|
| 78 |
if (!reconstructAtNodes && !reconstructAtMRCA && !countingStates && !dNdSRobustCounting) { |
| 79 |
return false; |
| 80 |
} |
| 81 |
|
| 82 |
switch (point) { |
| 83 |
case IN_FILE_LOG_PARAMETERS: |
| 84 |
return countingStates || dNdSRobustCounting; |
| 85 |
|
| 86 |
case IN_TREE_LIKELIHOOD: |
| 87 |
return countingStates; |
| 88 |
|
| 89 |
case IN_TREES_LOG: |
| 90 |
return reconstructAtNodes || countingStates || dNdSRobustCounting; |
| 91 |
|
| 92 |
case AFTER_OPERATORS: |
| 93 |
return dNdSRobustCounting; |
| 94 |
|
| 95 |
case AFTER_TREES_LOG: |
| 96 |
return reconstructAtMRCA || dNdSRobustCounting || completeHistory; |
| 97 |
|
| 98 |
case AFTER_MCMC: |
| 99 |
return dNdSRobustCounting; |
| 100 |
|
| 101 |
default: |
| 102 |
return false; |
| 103 |
} |
| 104 |
|
| 105 |
} |
| 106 |
|
| 107 |
protected void generate(final InsertionPoint point, final Object item, final String prefix, final XMLWriter writer) { |
| 108 |
|
| 109 |
AncestralStatesComponentOptions component = (AncestralStatesComponentOptions) options |
| 110 |
.getComponentOptions(AncestralStatesComponentOptions.class); |
| 111 |
|
| 112 |
switch (point) { |
| 113 |
case AFTER_OPERATORS: |
| 114 |
writeCodonPartitionedRobustCounting(writer, component); |
| 115 |
break; |
| 116 |
case IN_TREE_LIKELIHOOD: |
| 117 |
writeCountingParameter(writer, (AbstractPartitionData) item, prefix); |
| 118 |
break; |
| 119 |
case IN_FILE_LOG_PARAMETERS: |
| 120 |
writeLogs(writer, component); |
| 121 |
break; |
| 122 |
case IN_TREES_LOG: |
| 123 |
writeTreeLogs(writer, component, (PartitionTreeModel)item); |
| 124 |
break; |
| 125 |
case AFTER_TREES_LOG: |
| 126 |
writeAncestralStateLoggers(writer, component); |
| 127 |
break; |
| 128 |
case AFTER_MCMC: |
| 129 |
writeDNdSPerSiteAnalysisReport(writer, component); |
| 130 |
break; |
| 131 |
default: |
| 132 |
throw new IllegalArgumentException( |
| 133 |
"This insertion point is not implemented for " |
| 134 |
+ this.getClass().getName()); |
| 135 |
} |
| 136 |
|
| 137 |
} |
| 138 |
|
| 139 |
private void writeCountingParameter(XMLWriter writer, AbstractPartitionData partition, String prefix) { |
| 140 |
AncestralStatesComponentOptions component = (AncestralStatesComponentOptions) options |
| 141 |
.getComponentOptions(AncestralStatesComponentOptions.class); |
| 142 |
if (!component.isCountingStates(partition)) { |
| 143 |
return; |
| 144 |
} |
| 145 |
|
| 146 |
StringBuilder matrix = new StringBuilder(); |
| 147 |
|
| 148 |
DataType dataType = partition.getDataType(); |
| 149 |
int stateCount = dataType.getStateCount(); |
| 150 |
|
| 151 |
if (dataType.getType() == DataType.GENERAL) { |
| 152 |
PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel(); |
| 153 |
stateCount = substModel.getDiscreteStateSet().size(); |
| 154 |
} |
| 155 |
|
| 156 |
for (int i = 0; i < stateCount; i++) { |
| 157 |
for (int j = 0; j < stateCount; j++) { |
| 158 |
if (i == j) { |
| 159 |
matrix.append(" 0.0"); |
| 160 |
} else { |
| 161 |
matrix.append(" 1.0"); |
| 162 |
} |
| 163 |
} |
| 164 |
} |
| 165 |
|
| 166 |
writer.writeTag("parameter", |
| 167 |
new Attribute[]{ |
| 168 |
new Attribute.Default<String>("id", partition.getPrefix() + "count"), |
| 169 |
new Attribute.Default<String>("value", matrix.toString())}, |
| 170 |
true); |
| 171 |
|
| 172 |
} |
| 173 |
|
| 174 |
protected String getCommentLabel() { |
| 175 |
return "Ancestral state reconstruction"; |
| 176 |
} |
| 177 |
|
| 178 |
private void writeCodonPartitionedRobustCounting(XMLWriter writer, |
| 179 |
AncestralStatesComponentOptions component) { |
| 180 |
|
| 181 |
for (AbstractPartitionData partition : options.getDataPartitions()) { |
| 182 |
|
| 183 |
if (component.dNdSRobustCounting(partition)) { |
| 184 |
writeCodonPartitionedRobustCounting(writer, partition, component.isCompleteHistoryLogging(partition)); |
| 185 |
} |
| 186 |
} |
| 187 |
} |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
private void writeCodonPartitionedRobustCounting(XMLWriter writer, |
| 192 |
AbstractPartitionData partition, |
| 193 |
boolean isCompleteHistoryLogging) { |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
writer.writeComment("Robust counting for: " + partition.getName()); |
| 200 |
|
| 201 |
|
| 202 |
String prefix = partition.getName() + "."; |
| 203 |
|
| 204 |
|
| 205 |
writer.writeOpenTag("codonPartitionedRobustCounting", |
| 206 |
new Attribute[]{ |
| 207 |
new Attribute.Default<String>("id", prefix + "robustCounting1"), |
| 208 |
new Attribute.Default<String>("labeling", "S"), |
| 209 |
new Attribute.Default<String>("prefix", prefix), |
| 210 |
new Attribute.Default<String>("saveCompleteHistory", |
| 211 |
isCompleteHistoryLogging ? "true" : "false"), |
| 212 |
new Attribute.Default<String>("useUniformization", |
| 213 |
"true"), |
| 214 |
new Attribute.Default<String>("unconditionedPerBranch", |
| 215 |
"true")}); |
| 216 |
|
| 217 |
writer.writeIDref("treeModel", "treeModel"); |
| 218 |
writer.writeOpenTag("firstPosition"); |
| 219 |
writer.writeIDref("ancestralTreeLikelihood", partition.getPrefix() + "CP1.treeLikelihood"); |
| 220 |
writer.writeCloseTag("firstPosition"); |
| 221 |
|
| 222 |
writer.writeOpenTag("secondPosition"); |
| 223 |
writer.writeIDref("ancestralTreeLikelihood", partition.getPrefix() + "CP2.treeLikelihood"); |
| 224 |
writer.writeCloseTag("secondPosition"); |
| 225 |
|
| 226 |
writer.writeOpenTag("thirdPosition"); |
| 227 |
writer.writeIDref("ancestralTreeLikelihood", partition.getPrefix() + "CP3.treeLikelihood"); |
| 228 |
writer.writeCloseTag("thirdPosition"); |
| 229 |
|
| 230 |
writer.writeCloseTag("codonPartitionedRobustCounting"); |
| 231 |
|
| 232 |
writer.writeBlankLine(); |
| 233 |
|
| 234 |
|
| 235 |
writer.writeOpenTag("codonPartitionedRobustCounting", |
| 236 |
new Attribute[]{ |
| 237 |
new Attribute.Default<String>("id", prefix + "robustCounting2"), |
| 238 |
new Attribute.Default<String>("labeling", "N"), |
| 239 |
new Attribute.Default<String>("prefix", prefix), |
| 240 |
new Attribute.Default<String>("saveCompleteHistory", |
| 241 |
isCompleteHistoryLogging ? "true" : "false"), |
| 242 |
new Attribute.Default<String>("useUniformization", |
| 243 |
"true"), |
| 244 |
new Attribute.Default<String>("unconditionedPerBranch", |
| 245 |
"true")}); |
| 246 |
|
| 247 |
writer.writeIDref("treeModel", "treeModel"); |
| 248 |
writer.writeOpenTag("firstPosition"); |
| 249 |
writer.writeIDref("ancestralTreeLikelihood", partition.getPrefix() + "CP1.treeLikelihood"); |
| 250 |
writer.writeCloseTag("firstPosition"); |
| 251 |
|
| 252 |
writer.writeOpenTag("secondPosition"); |
| 253 |
writer.writeIDref("ancestralTreeLikelihood", partition.getPrefix() + "CP2.treeLikelihood"); |
| 254 |
writer.writeCloseTag("secondPosition"); |
| 255 |
|
| 256 |
writer.writeOpenTag("thirdPosition"); |
| 257 |
writer.writeIDref("ancestralTreeLikelihood", partition.getPrefix() + "CP3.treeLikelihood"); |
| 258 |
writer.writeCloseTag("thirdPosition"); |
| 259 |
|
| 260 |
writer.writeCloseTag("codonPartitionedRobustCounting"); |
| 261 |
|
| 262 |
} |
| 263 |
|
| 264 |
private void writeLogs(XMLWriter writer, AncestralStatesComponentOptions component) { |
| 265 |
|
| 266 |
for (AbstractPartitionData partition : options.getDataPartitions()) { |
| 267 |
|
| 268 |
if (component.dNdSRobustCounting(partition)) { |
| 269 |
String prefix = partition.getName() + "."; |
| 270 |
|
| 271 |
writer.writeIDref("codonPartitionedRobustCounting", prefix + "robustCounting1"); |
| 272 |
writer.writeIDref("codonPartitionedRobustCounting", prefix + "robustCounting2"); |
| 273 |
} else { |
| 274 |
|
| 275 |
} |
| 276 |
} |
| 277 |
} |
| 278 |
|
| 279 |
private void writeTreeLogs(XMLWriter writer, AncestralStatesComponentOptions component, PartitionTreeModel treeModel) { |
| 280 |
|
| 281 |
for (AbstractPartitionData partition : options.getDataPartitions()) { |
| 282 |
|
| 283 |
if (partition.getPartitionTreeModel() == treeModel) { |
| 284 |
if (component.dNdSRobustCounting(partition)) { |
| 285 |
String prefix = partition.getName() + "."; |
| 286 |
|
| 287 |
writer.writeIDref("codonPartitionedRobustCounting", prefix + "robustCounting1"); |
| 288 |
writer.writeIDref("codonPartitionedRobustCounting", prefix + "robustCounting2"); |
| 289 |
} |
| 290 |
|
| 291 |
if (component.reconstructAtNodes(partition)) { |
| 292 |
|
| 293 |
|
| 294 |
PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel(); |
| 295 |
int cpCount = partition.getPartitionSubstitutionModel().getCodonPartitionCount(); |
| 296 |
|
| 297 |
if (cpCount > 1) { |
| 298 |
for (int i = 1; i <= substModel.getCodonPartitionCount(); i++) { |
| 299 |
String prefix = partition.getPrefix() + substModel.getPrefixCodon(i); |
| 300 |
String name = partition.getName() + "." + substModel.getPrefixCodon(i); |
| 301 |
if (name.endsWith(".")) { |
| 302 |
name = name.substring(0, name.length() - 1); |
| 303 |
} |
| 304 |
writeTrait(writer, partition, prefix, AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG, name); |
| 305 |
} |
| 306 |
} else { |
| 307 |
writeTrait(writer, partition, partition.getPrefix(), AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG, partition.getName()); |
| 308 |
} |
| 309 |
} |
| 310 |
|
| 311 |
if (component.isCountingStates(partition)) { |
| 312 |
if (partition.getDataType().getType() == DataType.CONTINUOUS) { |
| 313 |
throw new RuntimeException("Can't do counting on Continuous data partition"); |
| 314 |
} |
| 315 |
|
| 316 |
PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel(); |
| 317 |
int cpCount = partition.getPartitionSubstitutionModel().getCodonPartitionCount(); |
| 318 |
|
| 319 |
if (cpCount > 1) { |
| 320 |
for (int i = 1; i <= substModel.getCodonPartitionCount(); i++) { |
| 321 |
String prefix = partition.getPrefix() + substModel.getPrefixCodon(i); |
| 322 |
String name = partition.getName() + "." + substModel.getPrefixCodon(i) + "count"; |
| 323 |
writeTrait(writer, partition, prefix, "count", name); |
| 324 |
} |
| 325 |
} else { |
| 326 |
writeTrait(writer, partition, partition.getPrefix(), "count", partition.getName() + ".count"); |
| 327 |
|
| 328 |
} |
| 329 |
|
| 330 |
} |
| 331 |
} |
| 332 |
} |
| 333 |
} |
| 334 |
|
| 335 |
private void writeTrait(XMLWriter writer, AbstractPartitionData partition, String prefix, String tag, String name) { |
| 336 |
String traitName = prefix + tag; |
| 337 |
|
| 338 |
if (partition.getDataType().getType() == DataType.CONTINUOUS) { |
| 339 |
traitName = partition.getName(); |
| 340 |
} |
| 341 |
|
| 342 |
writer.writeOpenTag("trait", |
| 343 |
new Attribute[]{ |
| 344 |
new Attribute.Default<String>("name", traitName), |
| 345 |
new Attribute.Default<String>("tag", name) |
| 346 |
} |
| 347 |
); |
| 348 |
if (partition.getDataType().getType() == DataType.CONTINUOUS) { |
| 349 |
writer.writeIDref("multivariateTraitLikelihood", prefix + "traitLikelihood"); |
| 350 |
} else { |
| 351 |
writer.writeIDref("ancestralTreeLikelihood", prefix + "treeLikelihood"); |
| 352 |
} |
| 353 |
writer.writeCloseTag("trait"); |
| 354 |
} |
| 355 |
|
| 356 |
private void writeAncestralStateLoggers(XMLWriter writer, |
| 357 |
AncestralStatesComponentOptions component) { |
| 358 |
|
| 359 |
for (AbstractPartitionData partition : options.getDataPartitions()) { |
| 360 |
|
| 361 |
if (component.dNdSRobustCounting(partition)) { |
| 362 |
writeDNdSLogger(writer, partition); |
| 363 |
} |
| 364 |
if (component.reconstructAtMRCA(partition)) { |
| 365 |
writeStateLogger(writer, partition, component.getMRCATaxonSet(partition)); |
| 366 |
} |
| 367 |
|
| 368 |
if (component.isCountingStates(partition) && component.isCompleteHistoryLogging(partition)) { |
| 369 |
writeCompleteHistoryTreeLogToFile(writer, partition); |
| 370 |
} |
| 371 |
} |
| 372 |
} |
| 373 |
|
| 374 |
private void writeStateLogger(XMLWriter writer, AbstractPartitionData partition, String mrcaId) { |
| 375 |
|
| 376 |
writer.writeComment("Ancestral state reconstruction for: " + partition.getName()); |
| 377 |
|
| 378 |
writer.writeOpenTag("log", new Attribute[]{ |
| 379 |
new Attribute.Default<String>("id", "fileLog_" + partition.getName()), |
| 380 |
new Attribute.Default<String>("logEvery", Integer.toString(options.logEvery)), |
| 381 |
new Attribute.Default<String>("fileName", options.fileNameStem + "." + partition.getName() + STATE_LOG_SUFFIX)}); |
| 382 |
|
| 383 |
PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel(); |
| 384 |
int cpCount = partition.getPartitionSubstitutionModel().getCodonPartitionCount(); |
| 385 |
|
| 386 |
if (cpCount > 1) { |
| 387 |
for (int i = 1; i <= substModel.getCodonPartitionCount(); i++) { |
| 388 |
String prefix = partition.getPrefix() + substModel.getPrefixCodon(i); |
| 389 |
String name = partition.getName() + "." + substModel.getPrefixCodon(i); |
| 390 |
if (name.endsWith(".")) { |
| 391 |
name = name.substring(0, name.length() - 1); |
| 392 |
} |
| 393 |
writeAncestralTrait(writer, partition, mrcaId, prefix, name); |
| 394 |
} |
| 395 |
} else { |
| 396 |
writeAncestralTrait(writer, partition, mrcaId, partition.getPrefix(), partition.getName()); |
| 397 |
} |
| 398 |
|
| 399 |
writer.writeCloseTag("log"); |
| 400 |
|
| 401 |
} |
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
private void writeCompleteHistoryTreeLogToFile(XMLWriter writer, AbstractPartitionData partition) { |
| 410 |
writer.writeComment("write complete history tree log to file"); |
| 411 |
|
| 412 |
PartitionTreeModel tree = partition.getPartitionTreeModel(); |
| 413 |
|
| 414 |
String treeLogFileName = options.fileNameStem + "." + partition.getPrefix() + "history.trees"; |
| 415 |
|
| 416 |
if (options.treeFileName.get(0).endsWith(".txt")) { |
| 417 |
treeLogFileName += ".txt"; |
| 418 |
} |
| 419 |
|
| 420 |
|
| 421 |
List<Attribute> attributes = new ArrayList<Attribute>(); |
| 422 |
attributes.add(new Attribute.Default<String>(TreeLoggerParser.LOG_EVERY, options.logEvery + "")); |
| 423 |
attributes.add(new Attribute.Default<String>(TreeLoggerParser.NEXUS_FORMAT, "true")); |
| 424 |
attributes.add(new Attribute.Default<String>(TreeLoggerParser.FILE_NAME, treeLogFileName)); |
| 425 |
attributes.add(new Attribute.Default<String>(TreeLoggerParser.SORT_TRANSLATION_TABLE, "true")); |
| 426 |
|
| 427 |
writer.writeOpenTag(TreeLoggerParser.LOG_TREE, attributes); |
| 428 |
|
| 429 |
writer.writeIDref(TreeModel.TREE_MODEL, tree.getPrefix() + TreeModel.TREE_MODEL); |
| 430 |
|
| 431 |
String historyLoggerId = partition.getPrefix() + "treeLikelihood"; |
| 432 |
writer.writeIDref(MarkovJumpsTreeLikelihoodParser.MARKOV_JUMP_TREE_LIKELIHOOD, historyLoggerId); |
| 433 |
|
| 434 |
writer.writeCloseTag(TreeLoggerParser.LOG_TREE); |
| 435 |
} |
| 436 |
|
| 437 |
private void writeAncestralTrait(XMLWriter writer, AbstractPartitionData partition, String mrcaId, String prefix, String nameString) { |
| 438 |
String traitName = prefix + AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG; |
| 439 |
if (partition.getDataType().getType() == DataType.CONTINUOUS) { |
| 440 |
traitName = partition.getName(); |
| 441 |
} |
| 442 |
|
| 443 |
writer.writeOpenTag("ancestralTrait", |
| 444 |
new Attribute[]{ |
| 445 |
new Attribute.Default<String>("name", nameString), |
| 446 |
new Attribute.Default<String>("traitName", traitName) |
| 447 |
} |
| 448 |
); |
| 449 |
writer.writeIDref("treeModel", partition.getPartitionTreeModel().getPrefix() + "treeModel"); |
| 450 |
|
| 451 |
if (partition.getDataType().getType() == DataType.CONTINUOUS) { |
| 452 |
writer.writeIDref("multivariateTraitLikelihood", prefix + "traitLikelihood"); |
| 453 |
} else { |
| 454 |
writer.writeIDref("ancestralTreeLikelihood", prefix + "treeLikelihood"); |
| 455 |
} |
| 456 |
|
| 457 |
if (mrcaId != null) { |
| 458 |
writer.writeOpenTag("mrca"); |
| 459 |
writer.writeIDref("taxa", mrcaId); |
| 460 |
writer.writeCloseTag("mrca"); |
| 461 |
} |
| 462 |
writer.writeCloseTag("ancestralTrait"); |
| 463 |
} |
| 464 |
|
| 465 |
private void writeDNdSLogger(XMLWriter writer, AbstractPartitionData partition) { |
| 466 |
|
| 467 |
String prefix = partition.getName() + "."; |
| 468 |
|
| 469 |
writer.writeComment("Robust counting for: " + partition.getName()); |
| 470 |
|
| 471 |
writer.writeOpenTag("log", new Attribute[]{ |
| 472 |
new Attribute.Default<String>("id", "fileLog_dNdS_" + partition.getName()), |
| 473 |
new Attribute.Default<String>("logEvery", Integer.toString(options.logEvery)), |
| 474 |
new Attribute.Default<String>("fileName", options.fileNameStem + "." + partition.getName() + DNDS_LOG_SUFFIX)}); |
| 475 |
|
| 476 |
writer.writeOpenTag("dNdSLogger", new Attribute[]{new Attribute.Default<String>("id", |
| 477 |
partition.getName() + ".dNdS")}); |
| 478 |
writer.writeIDref("treeModel", "treeModel"); |
| 479 |
writer.writeIDref("codonPartitionedRobustCounting", prefix + "robustCounting1"); |
| 480 |
writer.writeIDref("codonPartitionedRobustCounting", prefix + "robustCounting2"); |
| 481 |
writer.writeCloseTag("dNdSLogger"); |
| 482 |
|
| 483 |
writer.writeCloseTag("log"); |
| 484 |
|
| 485 |
} |
| 486 |
|
| 487 |
private void writeDNdSPerSiteAnalysisReport(XMLWriter writer, |
| 488 |
AncestralStatesComponentOptions component) { |
| 489 |
|
| 490 |
for (AbstractPartitionData partition : options.getDataPartitions()) { |
| 491 |
|
| 492 |
if (component.dNdSRobustCounting(partition)) { |
| 493 |
writeDNdSPerSiteAnalysisReport(writer, partition); |
| 494 |
} |
| 495 |
} |
| 496 |
} |
| 497 |
|
| 498 |
private void writeDNdSPerSiteAnalysisReport(XMLWriter writer, |
| 499 |
AbstractPartitionData partition) { |
| 500 |
|
| 501 |
writer.writeComment("Robust counting for: " + partition.getName()); |
| 502 |
|
| 503 |
writer.writeOpenTag("report"); |
| 504 |
|
| 505 |
writer.write("<dNdSPerSiteAnalysis fileName=\"" + options.fileNameStem + "." + partition.getName() + DNDS_LOG_SUFFIX + "\"/> \n"); |
| 506 |
|
| 507 |
writer.writeCloseTag("report"); |
| 508 |
|
| 509 |
} |
| 510 |
|
| 511 |
} |