diff --git a/lphybeast/src/main/java/lphybeast/BEASTContext.java b/lphybeast/src/main/java/lphybeast/BEASTContext.java index 848b7c4..a5958b8 100644 --- a/lphybeast/src/main/java/lphybeast/BEASTContext.java +++ b/lphybeast/src/main/java/lphybeast/BEASTContext.java @@ -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; @@ -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> sinks = parserDictionary.getDataModelSinks(); for (Value value : sinks) { @@ -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 visited) { Generator generator = value.getGenerator();