Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2-cycle (parallel edges) proposed in SNaQ #210

Closed
cecileane opened this issue Apr 12, 2024 · 1 comment
Closed

2-cycle (parallel edges) proposed in SNaQ #210

cecileane opened this issue Apr 12, 2024 · 1 comment

Comments

@cecileane
Copy link
Member

Here is a reproducible example of the error reported here.

For now, reproducing the error requires to use the snaq2cfix branch of PhyloNetwork. Do this in pkg mode within julia to use that branch:

pkg> add PhyloNetworks#snaq2cfix

The code below reproduces the error on julia v1.10.2, using the lower-level function optTopLevel! instead than snaq! to control the type of topology updates being proposed.

using Random, PhyloNetworks

dcf = readTableCF(joinpath(dirname(pathof(PhyloNetworks)), "..", "examples", "tableCF.txt"))
net3c_newick = "(1,2,(((3,4))#H1:::0.6,(#H1:::0.4,(5,6))));" # 3-cycle adjacent to 3 cherries
Random.seed!(5)
PhyloNetworks.optTopLevel!(readTopologyLevel1(net3c_newick),0.01,75, dcf, 2, # hmax=2
  1e-5,1e-6,1e-3,1e-4, false,true, [0,0,10,0,0,0], # to propose move 3 only: MVtarget
  stdout,false)
ERROR: cycle with only 2 nodes: parallel edges

The error occurs because the current network has a 3-cycle (whose 3 nodes are each adjacent to a group with 2+ taxa), and the proposed topology modifies this 3-cycle into a 2-cycle of 2 parallel edges. We have a diagnostic and a small reproducible example: a great start to find a fix 😄

@cecileane
Copy link
Member Author

cecileane commented May 2, 2024

After the simplified random integer generation in commit 8cf9b85, and in julia v1.10.3, we need a different seed to reproduce the error, for example:

Random.seed!(3)
PhyloNetworks.optTopLevel!(readTopologyLevel1(net3c_newick),0.01,75, dcf, 2, # hmax=2
  1e-5,1e-6,1e-3,1e-4, false,true, [0,0,10,0,0,0], # to propose move 3 only: MVtarget
  stdout,false)

Also, the error is fixed with commit e890cc2.
To reproduce an analysis with the fix but without the change in random integer generation, then, we can pin the package at that commit, doing this in package mode within julia:

pkg> add PhyloNetworks#e890cc2be3d3068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant