PoonLab / Kaphi

Kernel-embedded ABC-SMC for phylodynamic inference
GNU Affero General Public License v3.0
4 stars 2 forks source link

test.speciation.model not passing #144

Closed ArtPoon closed 5 years ago

ArtPoon commented 5 years ago
1 Test Suite : 
Kaphi - 29 test functions, 2 errors, 0 failures
ERROR in test.speciation.model: Error in if (V(g1)$production[c1] != V(g2)$production[c2]) { : 
  missing value where TRUE/FALSE needed
DEACTIVATED test.kernel.label: 
ERROR in test.perturb.particles: Error in if (V(g1)$production[c1] != V(g2)$production[c2]) { : 
  missing value where TRUE/FALSE needed
ArtPoon commented 5 years ago

This occurs for computing the kernel score of the tree against itself. n1 and n2 are both 16. This occurs because V(g1)$children[[n1]] returns the value integer(0).

n1 is an internal node. The children vector should have meaningful values for this node, not integer(0). This is happening because the ordering of nodes in children does not match the numbering of nodes in the tree.

> reorder(tree, order='postorder', index.only=T)
 [1] 35 36 34 37 29 30 28 31 24 25 21 22 20 23 19 26 15 16 14 17  9 10  8 11  7
[26] 12  6 13  5 18  4 27  3 32  2 33  1 38
> sapply(.get.children(g), length)
 [1] 2 2 2 2 2 2 2 2 2 0 0 0 0 2 2 0 0 0 2 2 2 0 0 2 0 0 0 2 2 0 0 0 0 2 2 0 0 0
[39] 0

Let's try reordering the tree as the first step in .tree.to.igraph. Then:

> sapply(.get.children(g), length)
 [1] 2 0 0 2 0 2 0 0 2 0 2 0 0 2 0 0 2 2 0 2 0 0 2 0 2 0 0 2 0 2 0 2 2 2 2 0 2 2
[39] 0