kfuku52 / RADTE

Divergence time estimation in the complex history of gene family evolution
MIT License
8 stars 2 forks source link

Error in gene tree processing #3

Closed fka21 closed 3 years ago

fka21 commented 3 years ago

Hello,

First of all let me thank you for setting up this tool, been searching for something like it before. I tried to follow the tutorial provided with my own dataset and provided the same parameters as in the the tutorial, but got the following error message:

Start: species tree processing
Read 1 item
Minimum edge length: 0
Number of short edges ( length < 0.001 ): 6
Transfering branch length from edge 22 to 23 and 60
Transfering branch length from edge 28 to 29 and 50
Transfering branch length from edge 33 to 34 and 37
Transfering branch length from edge 39 to 40 and 43
Transfering branch length from edge 51 to 52 and 59
The tree is not ultrametric. Adjusting the branch length.
Total branch length difference between before- and after-adjustment: 0.0004614733
Nonzero tip age(s) were detected (max=1.4210854715202e-14). Coercing to 0.
End: species tree processing

Start: gene tree processing
Reading NOTUNG tree.
[1] "n2" "n5" "n6"
 Named int [1:3] 12 15 16
 - attr(*, "names")= chr [1:3] "n2" "n5" "n6"
NULL
Error in x[[jj]][iseq] <- vjj : replacement has length zero
Calls: [<- -> [<-.data.frame
In addition: Warning message:
In min(sp_node_table$age[sapply(sp_node_table$spp, function(x) { :
  no non-missing arguments to min; returning Inf

What do you think I am doing wrong?

Cheers

kfuku52 commented 3 years ago

Thank you for reporting! Would it be possible to share your input trees?

fka21 commented 3 years ago

Hello, thank you for the quick reply. Not the exact same tree, but another tree which produces the same error. It is the reconciled tree from Notung v2.9.1.5.

(((((Steinernema_carpocapsae_L596_020554:0.0812499,Steinernema_carpocapsae_L596_026598.1:0.162784)n4:0.187569,(Steinernema_feltiae_L889_g3965.t1:0.247091,Steinernema_feltiae_L889_g12653.t1:0.261399)n5:0.174948)n3:1.15416,(((Steinernema_carpocapsae_L596_019371:0.446027,Steinernema_feltiae_L889_g20381.t1:0.766593)n8:0.388058,(Steinernema_carpocapsae_L596_028030.1:0.944139,Steinernema_feltiae_L889_g2036.t1:3.29597)n9:0.48365)n7:0.194342,((((((Steinernema_carpocapsae_L596_020935:0.158974,Steinernema_feltiae_L889_g9453.t1:0.284536)n15:0.0908811,((Steinernema_feltiae_L889_g9452.t1:0.222104,Steinernema_feltiae_L889_g2840.t1:0.0383684)n17:0.180408,Steinernema_carpocapsae_L596_020934:0.696928)n16:0.0774365)n14:0.135463,((((Steinernema_feltiae_L889_g14108.t1:0.0479942,Steinernema_feltiae_L889_g7465.t1:0.316235)n21:0.0884201,Steinernema_feltiae_L889_g4045.t1:6.0E-9)n20:0.186351,Steinernema_feltiae_L889_g3289.t1:0.130419)n19:0.578456,((Steinernema_feltiae_L889_g8486.t1:0.294834,Steinernema_carpocapsae_L596_030428:0.496554)n23:0.235685,((Steinernema_feltiae_L889_g5223.t1:0.0203876,Steinernema_feltiae_L889_g2839.t1:0.0215004)n25:0.305859,Steinernema_carpocapsae_L596_020946:0.205787)n24:0.0339843)n22:0.0593809)n18:0.142929)n13:0.157643,(Steinernema_feltiae_L889_g7917.t2:0.142429,Steinernema_feltiae_L889_g12467.t1:0.105001)n26:0.506928)n12:0.0524064,(((Steinernema_carpocapsae_L596_026600:3.62502,Steinernema_feltiae_L889_g18105.t1:6.0E-9)n29:1.97058,((Steinernema_feltiae_L889_g6086.t1:0.109667,Steinernema_feltiae_L889_g13949.t1:0.339027)n31:0.206936,Steinernema_carpocapsae_L596_027050:0.405061)n30:0.0229929)n28:0.116389,Steinernema_feltiae_L889_g4079.t1:0.417808)n27:0.28686)n11:0.12929,((((Steinernema_feltiae_L889_g11866.t1:0.0860922,Steinernema_carpocapsae_L596_020656:0.722846)n35:0.278392,(Steinernema_feltiae_L889_g2234.t1:0.221814,Steinernema_carpocapsae_L596_019796:0.522306)n36:0.188425)n34:0.124006,((((Steinernema_feltiae_L889_g9666.t1:0.108262,Steinernema_feltiae_L889_g9593.t1:0.0330123)n40:0.0386496,(Steinernema_feltiae_L889_g501.t1:0.204465,Steinernema_feltiae_L889_g500.t1:0.270683)n41:0.0776976)n39:0.377888,(Steinernema_feltiae_L889_g5409.t1:0.0345441,Steinernema_feltiae_L889_g243.t1:0.00302101)n42:0.107822)n38:0.0119802,Steinernema_carpocapsae_L596_020279:0.103429)n37:0.281685)n33:0.036635,((((Steinernema_carpocapsae_L596_014014:0.14299,Steinernema_carpocapsae_L596_014015:0.250342)n46:0.140193,(Steinernema_carpocapsae_L596_019367:0.180108,Steinernema_carpocapsae_L596_019366.1:0.205268)n47:0.0917623)n45:0.0998511,(((Steinernema_feltiae_L889_g8047.t1:5.0E-9,Steinernema_feltiae_L889_g6213.t1:0.0181527)n50:0.227161,Steinernema_carpocapsae_L596_013992:0.0985974)n49:0.272102,((((Steinernema_carpocapsae_L596_020630.3:0.287944,Steinernema_carpocapsae_L596_020629:0.176025)n54:0.0554557,Steinernema_carpocapsae_L596_020628:0.136658)n53:0.0839616,Steinernema_carpocapsae_L596_019368:0.111249)n52:0.132986,(((Steinernema_feltiae_L889_g24605.t1:0.152519,Steinernema_feltiae_L889_g2356.t1:0.0323048)n57:0.00646382,Steinernema_feltiae_L889_g819.t1:0.0166671)n56:0.580582,((Steinernema_feltiae_L889_g5392.t1:0.00283383,Steinernema_feltiae_L889_g5391.t1:0.269966)n59:0.14481,(Steinernema_feltiae_L889_g8709.t1:5.0E-9,Steinernema_feltiae_L889_g10795.t2:0.207903)n60:0.0821074)n58:0.176646)n55:0.0196273)n51:0.0344579)n48:0.0509817)n44:0.0958376,(((Steinernema_feltiae_L889_g17673.t1:0.279278,Steinernema_feltiae_L889_g17672.t1:0.165214)n63:0.295933,((Steinernema_feltiae_L889_g6567.t1:0.17658,Steinernema_feltiae_L889_g22771.t1:0.346269)n65:0.176798,Steinernema_feltiae_L889_g3143.t1:0.162293)n64:0.121925)n62:0.136563,Steinernema_carpocapsae_L596_013994:0.330627)n61:0.132575)n43:0.108698)n32:0.0892593)n10:0.128882)n6:0.0974815)n2:0.208968,Steinernema_carpocapsae_L596_013995:0.326229)n1:0.813658,Ascaris_suum_AgB10_g203_t01:0.813658)n0;

kfuku52 commented 3 years ago

Thank you. This looks like a gene tree. I need a species tree too to reproduce the error.

fka21 commented 3 years ago

Oh, my apologies. Below you can find the species tree used.

(Nematostella_vectensis:50,((Branchiostoma_lanceolatum:23.7101,(Danio_rerio:21.6029,(((Bos_taurus:8.70223,Capra_hircus:8.70223)N14:5.68206,(Mus_musculus:13.2604,(Homo_sapiens:7.85935,Macaca_mulatta:7.85935)N17:5.4011)N15:1.12384)N9:5.34555,(Xenopus_tropicalis:18.0441,Gallus_gallus:18.0441)N10:1.68576)N6:1.87307)N4:2.1072)N2:17.8611,(Crassostrea_gigas:35.952,(((Hypsibius_dujardini:26.1183,(Blattella_germanica:16.5116,(((Anopheles_stephensi:10.5211,(((Drosophila_persimilis:4.10651,Drosophila_willistoni:4.10651):0,(Drosophila_ananassae:2.23344,((Drosophila_melanogaster:1.63138,Drosophila_erecta:1.63138):0,(Drosophila_simulans:1.63138,Drosophila_yakuba:1.63138):0)N23:0.602059)N22:1.87307)N20:2.1072,(Drosophila_mojavensis:4.10651,Drosophila_virilis:4.10651)N21:2.1072)N19:4.30736)N18:4.58568,Bombyx_mori:15.1068):0,Tribolium_castaneum:15.1068)N16:1.4048)N11:9.60679)N7:5.61921,(((Steinernema_carpocapsae:6.21372,Steinernema_feltiae:6.21372)N12:4.30736,(Caenorhabditis_elegans:6.21372,Caenorhabditis_angaria:6.21372)N13:4.30736):0,Ascaris_suum:10.5211)N8:21.2165):0,Priapulus_caudatus:31.7376)N5:4.21441)N3:5.61921)N1:8.42882)N0

kfuku52 commented 3 years ago

Oops, I needed .parsable file too for the NOTUNG input. Could you also tell me the full radte.r command you tried?

fka21 commented 3 years ago

Here is the parsable file and also the command used. Should've shared these too, sorry.

./radte.r --species_tree=/Users/ferenckagan/Documents/Bioinformatic_analysis/laptop/Bioinformatic_analysis/Phylotranscriptomics/SpeciesTree_rooted_node_labels_binary.txt --gene_tree=/Users/ferenckagan/Documents/Bioinformatic_analysis/laptop/Bioinformatic_analysis/Phylotranscriptomics/Gene_tree_reconciliation/Notung_gene_trees/OG0000999_binary.txt.reconciled --notung_parsable=/Users/ferenckagan/Documents/Bioinformatic_analysis/laptop/Bioinformatic_analysis/Phylotranscriptomics/Gene_tree_reconciliation/Notung_gene_trees/OG0000999_binary.txt.reconciled.parsable.txt --max_age=1000 --chronos_lambda=1 --chronos_model=discrete --pad_short_edge=0.001

81.0    50      0       0       6       67      133     9       14      3       true    N8      N8      0.00646382,1.97058      Off     1       1       1.5     0.0     3.0     1.0
Cost    nD      nCD     nT      nL      |L(G)|  |G|     |S|     h(G)    h(S)    isRoot   root(G)         root(S)        minEW,maxEW     Roots   Cand    Feas    cD      cCD     cT      cL

#D      Gene Node       L. Bound        U. Bound
#D      n1      N12     n316
#D      n2      N12     n316
#D      n4      Steinernema_carpocapsae N12
#D      n5      Steinernema_feltiae     N12
#D      n6      N12     n316
#D      n7      N12     n316
#D      n10     N12     n316
#D      n11     N12     n316
#D      n12     N12     n316
#D      n13     N12     n316
#D      n14     N12     n316
#D      n17     Steinernema_feltiae     N12
#D      n18     N12     n316
#D      n19     Steinernema_feltiae     N12
#D      n20     Steinernema_feltiae     N12
#D      n21     Steinernema_feltiae     N12
#D      n22     N12     n316
#D      n25     Steinernema_feltiae     N12
#D      n26     Steinernema_feltiae     N12
#D      n27     N12     n316
#D      n28     N12     n316
#D      n31     Steinernema_feltiae     N12
#D      n32     N12     n316
#D      n33     N12     n316
#D      n34     N12     n316
#D      n38     Steinernema_feltiae     N12
#D      n39     Steinernema_feltiae     N12
#D      n40     Steinernema_feltiae     N12
#D      n41     Steinernema_feltiae     N12
#D      n42     Steinernema_feltiae     N12
#D      n43     N12     n316
#D      n44     N12     n316
#D      n45     Steinernema_carpocapsae N12
#D      n46     Steinernema_carpocapsae N12
#D      n47     Steinernema_carpocapsae N12
#D      n48     N12     n316
#D      n50     Steinernema_feltiae     N12
#D      n52     Steinernema_carpocapsae N12
#D      n53     Steinernema_carpocapsae N12
#D      n54     Steinernema_carpocapsae N12
#D      n55     Steinernema_feltiae     N12
#D      n56     Steinernema_feltiae     N12
#D      n57     Steinernema_feltiae     N12
#D      n58     Steinernema_feltiae     N12
#D      n59     Steinernema_feltiae     N12
#D      n60     Steinernema_feltiae     N12
#D      n62     Steinernema_feltiae     N12
#D      n63     Steinernema_feltiae     N12
#D      n64     Steinernema_feltiae     N12
#D      n65     Steinernema_feltiae     N12

#LinS   Species Losses
#L      Steinernema_carpocapsae 3
#L      n316    0
#L      N13     1
#L      Caenorhabditis_elegans  0
#L      Steinernema_feltiae     2
#L      Caenorhabditis_angaria  0
#L      N12     0
#L      Ascaris_suum    0
#L      N8      0

#S      Species Dups    cDs     Trans_from      Trans_to        Losses
#S      Steinernema_carpocapsae 7       0       0       0       3
#S      n316    0       0       0       0       0
#S      N13     0       0       0       0       1
#S      Caenorhabditis_elegans  0       0       0       0       0
#S      Steinernema_feltiae     24      0       0       0       2
#S      Caenorhabditis_angaria  0       0       0       0       0
#S      N12     19      0       0       0       0
#S      Ascaris_suum    0       0       0       0       0
#S      N8      0       0       0       0       0

#R      SpeciesAtRoot
#R      N8
kfuku52 commented 3 years ago

I couldn't reproduce the error... Could you share the all inputs as a zipped file? Copying-and-pasting may cause some troubles. I can fix apparent errors such as the missing semi-colon in the species tree, but there may be something more.

fka21 commented 3 years ago

Here it is: gene_tree_error.zip

kfuku52 commented 3 years ago

I couldn't reproduce the error still but found that the species tree contains non-labeled nodes. I've just updated the radte to return an error for the format violation. Could you retry with the latest radte.r? You should be able to get the correct outputs (below) if the species tree was properly labeled, for example, with the following command.

result.zip

R -q -e "library(ape); t=read.tree('species_tree_noLabel.nwk'); \
t[['node.label']]=paste0('s',1:Nnode(t)); \
write.tree(t, 'species_tree.nwk')"
fka21 commented 3 years ago

The update seemed to have worked. Indeed it pointed out the format violation and after fixing it it works good. 👍 Thank you very much for the help!