etetoolkit / ete

Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
http://etetoolkit.org
GNU General Public License v3.0
773 stars 216 forks source link

ete3.parser.newick.NewickError #668

Closed danrans123 closed 1 year ago

danrans123 commented 1 year ago

Hi, I try to extract the subset tree by ete3, but i get a ERROR: ete3.parser.newick.NewickError: Unexpected newick format 'Cycadaceae:10.322225'

My command as below: from ete3 import Tree t=Tree("/gss2/data_sri5k20x/a_a_hjb20181119/jiangfenfen/GERP/tree/Vascular_Plants_rooted.dated.tre") subtree_taxa=["Arabidopsis_thaliana","Cajanus_cajan","Lupinus_angustifolius","Medicago_truncatula", "Oryza_sativa","Phaseolus_vulgaris", "Populus_trichocarpa","Prunus_persica","Vigna_radiata", "Zea_mays","Vitis_vinifera","Glycine_max"]

t.prune(subtree_taxa,preserve_branch_length=True) t.write()

Could you please give me help? Thanks!

dengzq1234 commented 1 year ago

Hi, would you provide the example tree? It seems to be a tree with format 1, so try using Tree(inputfile, format=1) or Tree(inputfile, format=1, quoted_node_names=True) if the internal names are quoted

danrans123 commented 1 year ago

Hi, thanks for the reply! It is indeed format 1. Using Tree(inputfile, format=1), it worked!