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

Custom network induces an additional leaf #43

Open
gaballench opened this issue Nov 2, 2021 · 1 comment
Open

Custom network induces an additional leaf #43

gaballench opened this issue Nov 2, 2021 · 1 comment

Comments

@gaballench
Copy link

Hello Joe,

I have noted that when using a custom network hybrid-Lambda generates gene trees where the hybrid edge "detaches" and becomes a leaf, that is, for the network including the hybrid edge h1#.5:4.0, the leaf h1#.5_1 is present in the gene trees. This behaviour is not recovered in some of the networks available in the trees directory that comes with the program. I tested both versions 0.6.2 and 0.6.3 and the behaviour is independent of the version. v0.6.2 was slightly modified for returning the magnitude of the diff between branches when testing the ultrametricity (see here).

The script:

#!/usr/bin/bash

# # custom network, not triggering ultrametricity warning, with or without root string
#  "(((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);"
#  "(((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;"
# # custom network, triggering ultrametricity warning, with or without root string
#  "(((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);"
#  "(((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;"
# # 3_tax_multi_tax_test_hybrid1, with or without root string
#  "(((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6)r;"
#  "(((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);"
# # 6_tax_multi_tax_test_hybrid1_topo1, with or without root string
#  "((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6)r;"
#  "((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);"

VARS=("(((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);" "(((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;" "(((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);" "(((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;" "(((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6)r;" "(((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);" "((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6)r;" "((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);")

for i in ${VARS[@]}; do
    echo $i
done

for i in ${VARS[@]}; do
    printf "\nProcessing $i...\n"
    hybrid-Lambdav0.6.2-pathdiff -spcu $i -num 3 -seed 2 -o out0.6.2
    grep "#" out0.6.2_coal_unit
#    cat out0.6.2_coal_unit
    hybrid-Lambdav0.6.3 -spcu $i -num 3 -seed 2 -o out0.6.3
    grep "#" out0.6.3_coal_unit
#    cat out0.6.3_coal_unit
done

rm out0*

generates this output:

(((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);
(((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;
(((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);
(((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;
(((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6)r;
(((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);
((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6)r;
((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);

Processing (((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);...
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Random seed: 2
Produced gene tree files: 
out0.6.2_coal_unit
((((A_1:2.291561,B_1:2.291561):2.813411,C_1:5.104972):2.956590,(D_1:5.898695,h1#0.5_1:5.898695):2.162867):1.080899,E_1:9.142461);
((D_1:7.822784,(((A_1:2.834647,B_1:2.834647):2.224355,C_1:5.059002):2.132514,h1#0.5_1:7.191516):0.631268):1.370331,E_1:9.193115);
(E_1:10.983763,((h1#0.5_1:8.657187,(C_1:6.141945,(A_1:2.412703,B_1:2.412703):3.729242):2.515241):0.759950,D_1:9.417136):1.566627);
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Random seed: 2
Produced gene tree files: 
out0.6.3_coal_unit
((((A_1:2.291561,B_1:2.291561):2.813411,C_1:5.104972):2.956590,(D_1:5.898695,h1#0.5_1:5.898695):2.162867):1.080899,E_1:9.142461);
((D_1:7.822784,(((A_1:2.834647,B_1:2.834647):2.224355,C_1:5.059002):2.132514,h1#0.5_1:7.191516):0.631268):1.370331,E_1:9.193115);
(E_1:10.983763,((h1#0.5_1:8.657187,(C_1:6.141945,(A_1:2.412703,B_1:2.412703):3.729242):2.515241):0.759950,D_1:9.417136):1.566627);

Processing (((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;...
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Random seed: 2
Produced gene tree files: 
out0.6.2_coal_unit
((((A_1:2.291561,B_1:2.291561):2.813411,C_1:5.104972):2.956590,(D_1:5.898695,h1#0.5_1:5.898695):2.162867):1.080899,E_1:9.142461);
((D_1:7.822784,(((A_1:2.834647,B_1:2.834647):2.224355,C_1:5.059002):2.132514,h1#0.5_1:7.191516):0.631268):1.370331,E_1:9.193115);
(E_1:10.983763,((h1#0.5_1:8.657187,(C_1:6.141945,(A_1:2.412703,B_1:2.412703):3.729242):2.515241):0.759950,D_1:9.417136):1.566627);
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Random seed: 2
Produced gene tree files: 
out0.6.3_coal_unit
((((A_1:2.291561,B_1:2.291561):2.813411,C_1:5.104972):2.956590,(D_1:5.898695,h1#0.5_1:5.898695):2.162867):1.080899,E_1:9.142461);
((D_1:7.822784,(((A_1:2.834647,B_1:2.834647):2.224355,C_1:5.059002):2.132514,h1#0.5_1:7.191516):0.631268):1.370331,E_1:9.193115);
(E_1:10.983763,((h1#0.5_1:8.657187,(C_1:6.141945,(A_1:2.412703,B_1:2.412703):3.729242):2.515241):0.759950,D_1:9.417136):1.566627);

Processing (((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);...
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Square diff in paths: 4
Absolute diff in paths: 2
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.2_coal_unit
((((A_1:2.291561,B_1:2.291561):2.813411,C_1:5.104972):2.956590,(D_1:5.898695,h1#0.5_1:3.898695):2.162867):1.080899,E_1:9.142461);
((D_1:7.822784,(((A_1:2.834647,B_1:2.834647):2.224355,C_1:5.059002):2.132514,h1#0.5_1:5.191516):0.631268):1.370331,E_1:9.193115);
(E_1:10.983763,((h1#0.5_1:6.657187,(C_1:6.141945,(A_1:2.412703,B_1:2.412703):3.729242):2.515241):0.759950,D_1:9.417136):1.566627);
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.3_coal_unit
((((A_1:2.291561,B_1:2.291561):2.813411,C_1:5.104972):2.956590,(D_1:5.898695,h1#0.5_1:3.898695):2.162867):1.080899,E_1:9.142461);
((D_1:7.822784,(((A_1:2.834647,B_1:2.834647):2.224355,C_1:5.059002):2.132514,h1#0.5_1:5.191516):0.631268):1.370331,E_1:9.193115);
(E_1:10.983763,((h1#0.5_1:6.657187,(C_1:6.141945,(A_1:2.412703,B_1:2.412703):3.729242):2.515241):0.759950,D_1:9.417136):1.566627);

Processing (((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;...
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Square diff in paths: 4
Absolute diff in paths: 2
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.2_coal_unit
((((A_1:2.291561,B_1:2.291561):2.813411,C_1:5.104972):2.956590,(D_1:5.898695,h1#0.5_1:3.898695):2.162867):1.080899,E_1:9.142461);
((D_1:7.822784,(((A_1:2.834647,B_1:2.834647):2.224355,C_1:5.059002):2.132514,h1#0.5_1:5.191516):0.631268):1.370331,E_1:9.193115);
(E_1:10.983763,((h1#0.5_1:6.657187,(C_1:6.141945,(A_1:2.412703,B_1:2.412703):3.729242):2.515241):0.759950,D_1:9.417136):1.566627);
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.3_coal_unit
((((A_1:2.291561,B_1:2.291561):2.813411,C_1:5.104972):2.956590,(D_1:5.898695,h1#0.5_1:3.898695):2.162867):1.080899,E_1:9.142461);
((D_1:7.822784,(((A_1:2.834647,B_1:2.834647):2.224355,C_1:5.059002):2.132514,h1#0.5_1:5.191516):0.631268):1.370331,E_1:9.193115);
(E_1:10.983763,((h1#0.5_1:6.657187,(C_1:6.141945,(A_1:2.412703,B_1:2.412703):3.729242):2.515241):0.759950,D_1:9.417136):1.566627);

Processing (((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6)r;...
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Random seed: 2
Produced gene tree files: 
out0.6.2_coal_unit
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Random seed: 2
Produced gene tree files: 
out0.6.3_coal_unit

Processing (((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);...
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Square diff in paths: 0.36
Absolute diff in paths: 0.6
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.2_coal_unit
((h1#.5_1:1.717184,C_1:2.317184):1.157862,(A_1:2.232417,B_1:2.232417):1.242629);
(C_1:4.405919,(h1#.5_1:3.321777,(B_1:1.342461,A_1:1.342461):2.579316):0.484142);
(C_1:2.203538,((A_1:1.774547,B_1:1.774547):0.235875,h1#.5_1:1.410423):0.193115);
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.3_coal_unit
((h1#.5_1:1.717184,C_1:2.317184):1.157862,(A_1:2.232417,B_1:2.232417):1.242629);
(C_1:4.405919,(h1#.5_1:3.321777,(B_1:1.342461,A_1:1.342461):2.579316):0.484142);
(C_1:2.203538,((A_1:1.774547,B_1:1.774547):0.235875,h1#.5_1:1.410423):0.193115);

Processing ((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6)r;...
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Square diff in paths: 0.04
Absolute diff in paths: 0.2
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.2_coal_unit
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.3_coal_unit

Processing ((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);...
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
Square diff in paths: 0.04
Absolute diff in paths: 0.2
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.2_coal_unit
((h1#.5_1:2.260888,(F_1:3.542078,(E_1:1.883584,(B_1:1.048594,D_1:1.248594):0.034991):1.658494):1.118810):0.785922,(A_1:3.022269,C_1:3.022269):0.624541);
(((h1#.5_1:1.056655,C_1:1.656655):0.655545,(((E_1:0.996610,F_1:0.996610):0.646552,D_1:1.043162):0.628633,B_1:1.471795):1.840405):1.390280,A_1:3.702480);
((A_1:1.862379,(C_1:1.385222,h1#.5_1:0.785222):0.477157):1.079919,(B_1:1.495700,((E_1:1.098141,F_1:1.098141):0.265469,D_1:0.763609):0.932091):2.446598);
Default Kingman coalescent on all branches.
Default population size of 10000 on all branches. 
WARNING! NOT ULTRAMETRIC!!!
Random seed: 2
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
WARNING: Gene tree is not ultrametric
Produced gene tree files: 
out0.6.3_coal_unit
((h1#.5_1:2.260888,(F_1:3.542078,(E_1:1.883584,(B_1:1.048594,D_1:1.248594):0.034991):1.658494):1.118810):0.785922,(A_1:3.022269,C_1:3.022269):0.624541);
(((h1#.5_1:1.056655,C_1:1.656655):0.655545,(((E_1:0.996610,F_1:0.996610):0.646552,D_1:1.043162):0.628633,B_1:1.471795):1.840405):1.390280,A_1:3.702480);
((A_1:1.862379,(C_1:1.385222,h1#.5_1:0.785222):0.477157):1.079919,(B_1:1.495700,((E_1:1.098141,F_1:1.098141):0.265469,D_1:0.763609):0.932091):2.446598);

Thus, the following networks induce hybrid-Lambda to "detach" the hybrid edge and become a leaf:

(((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);
(((h1#0.5:4.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;
(((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0);
(((h1#0.5:2.0,D:4.0):3.0,((A:2.0,B:2.0):3.0,(C:2.0)h1#0.5:3.0):2.0):2.0,E:9.0)r;
(((B:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);
((((B:1,(D:0.6,(E:0.6,F:0.6)s5:0.6)s4:0.6)s3:.6)h1#.5:.6,A:1.2)s1:.6,(h1#.5:.6,C:1.2)s2:.6);

From there I see that on your networks from the trees directory these leaves only appear when the r root string is missing. However, on my custom networks these are present with or without the r string.

Any suggestion would be really appreciated to build my own custom networks as input for hybrid-Lambda.

Best wishes,

Gustavo

@shajoezhu
Copy link
Member

shajoezhu commented Nov 4, 2021 via email

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

2 participants