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
797 stars 214 forks source link

'--src_tree_format' has no effect with ete3 mod #306

Open Gullumluvl opened 7 years ago

Gullumluvl commented 7 years ago

Hi, I tried to load a newick tree with internal node names with ete3 mod, but when I add --src_tree_format=1 , it is totally ignored.

The newick file is the following:

(
  Cavia_porcellus:72.8767,
  (
    (
      (
        Rattus_norvegicus:20.8874,
        Mus_musculus:20.8874
      )Murinae:49.011,
      Dipodomys_ordii:69.8984
    )'13':0.646551,
    Ictidomys_tridecemlineatus:70.5449
  )'11':2.33178
)Rodentia:0;

When I run :

~/miniconda3/bin/ete3 mod --src_tree_format 1 -t Rodentia.timetree.taxa.nwk -o Rodentia.timetree.ladder --ladderize

I get this error :

Traceback (most recent call last):
  File "/users/gullum/.local/bin/ete3", line 9, in <module>
    load_entry_point('ete3==3.0.0b35', 'console_scripts', 'ete3')()
  File "/users/gullum/.local/lib/python2.7/site-packages/ete3/tools/ete.py", line 92, in main
    _main(sys.argv)
  File "/users/gullum/.local/lib/python2.7/site-packages/ete3/tools/ete.py", line 238, in _main
    args.func(args)
  File "/users/gullum/.local/lib/python2.7/site-packages/ete3/tools/ete_mod.py", line 98, in run
    t = Tree(nw)
  File "/users/gullum/.local/lib/python2.7/site-packages/ete3/coretype/tree.py", line 210, in __init__
    read_newick(newick, root_node = self, format=format)
  File "/users/gullum/.local/lib/python2.7/site-packages/ete3/parser/newick.py", line 237, in read_newick
    return _read_newick_from_string(nw, root_node, matcher, format)
  File "/users/gullum/.local/lib/python2.7/site-packages/ete3/parser/newick.py", line 289, in _read_newick_from_string
    _read_node_data(closing_internal, current_parent, "internal", matcher, formatcode)
  File "/users/gullum/.local/lib/python2.7/site-packages/ete3/parser/newick.py", line 386, in _read_node_data
    raise NewickError("Unexpected newick format '%s' " %subnw[0:50])
ete3.parser.newick.NewickError: Unexpected newick format 'Murinae:49.011'

This line in the error seems to show that the command-line option --src_tree_format is not propagated :

t = Tree(nw)

However, I tested with ete3 view and it worked fine.

Thanks a lot!

bernt-matthias commented 7 years ago

Also the -o parameter has no effect.

bernt-matthias commented 7 years ago

Potentially also:


 --src_tree_attr SRC_TREE_ATTR
                        attribute in source tree used as leaf name
  --src_attr_parser SRC_ATTR_PARSER
                        Perl regular expression wrapping the portion of the
                        target attribute that should be used.

At least I could not figure out how to use them.

bernt-matthias commented 7 years ago

what is mod doing when multiple values are provided with this option: -- ultrametric [ULTRAMETRIC [ULTRAMETRIC ...]]

also the parameter seems to have no effect:

With input ((A:1,B:1)1:1,C:2); ete3 mod -t tree.nhx -v 0 --ultrametric 10 returns an unmodified tree

bernt-matthias commented 7 years ago

--resolve_polytomies resolves polytomies, but its not random as the command line help suggests

jhcepas commented 7 years ago

thanks. ete-mod definitely not finished, need someone debugging all options. what do you mean --resolve_polytomies does not resolve multifurcations randomly? it depends on on the relative order of branches in the multifurcated branch, which is in principle random...

bernt-matthias commented 7 years ago

FYI: I'm just integrating a bit more of the etetoolkit functionality into Galaxy:

https://github.com/TGAC/earlham-galaxytools/pull/90

In particular I wrap ete3 mod. compare and view are on my todo list.

jhcepas commented 7 years ago

that's great. If you need to add changes to ete-mod, please go ahead. I am happy to accept PRs on that front.