Skip to content

Commit

Permalink
data clamping #164
Browse files Browse the repository at this point in the history
  • Loading branch information
walterxie committed Oct 22, 2024
1 parent 7151868 commit b5b4594
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lphybeast/src/main/java/lphybeast/BEASTContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import jebl.evolution.sequences.SequenceType;
import lphy.core.logger.LoggerUtils;
import lphy.core.model.*;
import lphy.core.parser.DataClampingUtils;
import lphy.core.parser.LPhyParserDictionary;
import lphy.core.parser.graphicalmodel.GraphicalModelNodeVisitor;
import lphy.core.parser.graphicalmodel.ValueCreator;
Expand Down Expand Up @@ -626,7 +627,7 @@ else if (bI.getID().equals(PRIOR_ID))
* Make a BEAST2 model from the current model in parser.
*/
private void createBEASTObjects() {

// all sinks of the graphical model, including in the data block.
List<Value<?>> sinks = parserDictionary.getDataModelSinks();

for (Value<?> value : sinks) {
Expand Down Expand Up @@ -675,12 +676,21 @@ private void createBEASTValueObjects(Value<?> value) {
}

// now that the inputs are done we can do this one.
if (beastObjects.get(value) == null) {
// TODO && is not data clamping
if (beastObjects.get(value) == null && !skipValue(value)) {
valueToBEAST(value);
}

}

// if data is clamped, skip valueToBEAST for simulated value in the model block,
// so that the XML would create duplicated alignment blocks.
private boolean skipValue(Value<?> value) {
if (DataClampingUtils.isClamped(value.getCanonicalId(), parserDictionary))
return parserDictionary.getModelValues().contains(value);
return false;
}

private void traverseBEASTGeneratorObjects(Value<?> value, boolean modifyValues, boolean createGenerators, Set<Generator> visited) {

Generator<?> generator = value.getGenerator();
Expand Down

0 comments on commit b5b4594

Please sign in to comment.