Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 public void sync(int iPartition) {
   if (parentInputs.size() > 0 && _input.get() != null) {
     Input<?> input = parentInputs.get(iPartition);
     if (bIsList) {
       List<Object> list = (List<Object>) _input.get();
       List<Object> targetList = ((List<Object>) input.get());
       // targetList.clear();
       // only clear former members
       for (BEASTInterface plugin : startInputs) {
         targetList.remove(plugin);
       }
       targetList.addAll(list);
       // sync outputs of items in list
       for (Object o : list) {
         if (o instanceof BEASTInterface) {
           ((BEASTInterface) o).getOutputs().add(parentPlugins.get(iPartition));
         }
       }
     } else {
       try {
         // System.err.println("sync " + parentPlugins.get(iPartition) + "[" + input.getName() + "]
         // = " + _input.get());
         input.setValue(_input.get(), parentPlugins.get(iPartition));
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
 }
Ejemplo n.º 2
0
  /**
   * @param newick a string representing a tree in newick format
   * @param adjustTipHeights true if the tip heights should be adjusted to 0 (i.e. contemporaneous)
   *     after reading in tree.
   * @param allowSingleChildNodes true if internal nodes with single children are allowed
   * @param isLabeled true if nodes are labeled with taxa labels
   * @param offset if isLabeled == false and node labeling starts with x then offset should be x.
   *     When isLabeled == true offset should be 1 as by default.
   * @throws Exception
   */
  public TreeParser(
      final String newick,
      final boolean adjustTipHeights,
      final boolean allowSingleChildNodes,
      final boolean isLabeled,
      final int offset)
      throws Exception {

    newickInput.setValue(newick, this);
    isLabelledNewickInput.setValue(isLabeled, this);
    adjustTipHeightsInput.setValue(adjustTipHeights, this);
    allowSingleChildInput.setValue(allowSingleChildNodes, this);

    offsetInput.setValue(offset, this);

    initAndValidate();
  }
Ejemplo n.º 3
0
  /**
   * Create a tree from the given newick format
   *
   * @param taxaNames a list of taxa names to use, or null. If null then IsLabelledNewick will be
   *     set to true
   * @param newick the newick of the tree
   * @param offset the offset to map node numbers in newick format to indices in taxaNames. so,
   *     name(node with nodeNumber) = taxaNames[nodeNumber-offset]
   * @param adjustTipHeightsWhenMissingDateTraits true if tip heights should be adjusted to zero
   * @throws Exception
   */
  public TreeParser(
      final List<String> taxaNames,
      final String newick,
      final int offset,
      final boolean adjustTipHeightsWhenMissingDateTraits)
      throws Exception {

    if (taxaNames == null) {
      isLabelledNewickInput.setValue(true, this);
    } else {
      m_taxonset.setValue(new TaxonSet(Taxon.createTaxonList(taxaNames)), this);
    }
    newickInput.setValue(newick, this);
    offsetInput.setValue(offset, this);
    adjustTipHeightsInput.setValue(adjustTipHeightsWhenMissingDateTraits, this);
    labels = taxaNames;
    initAndValidate();
  }
Ejemplo n.º 4
0
 public TreeParser(final Alignment alignment, final String newick) throws Exception {
   dataInput.setValue(alignment, this);
   newickInput.setValue(newick, this);
   initAndValidate();
 }