Skip to content

Conflict of Optimized Relaxed Clock and Sampled Ancestors #984

@Anaphory

Description

@Anaphory

A sudden IndexError in an analysis had me stumped for some time. I have now figured out why it happens, but not how to fix it.

Symptoms:

For the analysis that permits sampled ancestors, the Relaxed Clock dies with an index error somewhere in the branch-rates-aware narrow exchange (MetaNER) operator.
What happens is the following:

  1. The relaxed clock mechanism sets the dimension of the rate parameter to “number of nodes in the tree – 1”, and the number of nodes at that point is correctly “number of tips × 2 – 1”. For Sinotibetan, this is 98 rates and 99 nodes for 50 tips, with the nodes numbered 0 to 98.
  2. The model runs fine for several 100'000s of steps.
  3. The MetaNER tries to propose an exchange, but trying to look up the node D with number 98 it dies with an IndexError.

For a moment I thought I might have started with a sampled ancestor and then a Jump added an internal node which would put the total number of nodes, and therefore branches, and therefore rates needed, up by one without adjusting the dimension of the rates parameter. But that's not the case, sampled ancestors are not degree-2 nodes, but tips with a branch length of 0.

Investigating closer, I was greatly confused, because I know that node D in the MetaNER is a child, and that node 98 is always the root. Except:

/**
* Sets root without recalculating nodeCount or ensuring that root is the last node in the internal array.
* Currently only used by sampled ancestor tree operators. Use carefully!
*
* @param root the new root node
*/
public void setRootOnly(final Node root) {
//TODO should we flag this with startEditing since it is an operator call?
this.root = root;
}

This method messes with that invariant, and makes Sampled Ancestors and Optimized Relaxed Clocks incompatible.
Why is it there? Why can Sampled Ancestors not just use the same setRoot() as everyone else?
Is there a way to get SA to work with an ORC (I'm willing to modify and test code and supply patches, as you know), or am I stuck with the generic Relaxed Clock with its convergence issues?
Should I cross-link this issue to the SA and ORC repositories?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions