Robaina / MetaTag

metaTag: functional and taxonomical annotation of metagenomes through phylogenetic tree placement
https://robaina.github.io/MetaTag/
Apache License 2.0
1 stars 0 forks source link

error when relabelling the newick tree with the placements #85

Closed micronuria closed 2 years ago

micronuria commented 2 years ago

Hi,

After running the placement of metaG sequences of the nasA gene and labelled the placements, I tried to relabel eht epa-result.newick tree with the following command that seems correct:

python3 code/relabeltree.py \
 --tree envision/placements/nasA/epa_result.newick \
 --labels genes/nas/results/aioA_gold_short_ids_id_dict.pickle \
          genes/nas/results/napA_gold_short_ids_id_dict.pickle \
          genes/nas/results/narB_ref_database_id_dict.pickle \
          genes/nas/results/narB_gold_short_ids_id_dict.pickle \
          genes/nas/results/nasA_ref_database_id_dict.pickle \
          genes/nas/results/nasA_gold_short_ids_id_dict.pickle \
          genes/nas/results/nasC_gold_short_ids_id_dict.pickle \
          genes/nas/results/nasAN_gold_short_ids_id_dict.pickle \
          genes/nas/results/nasBB_gold_short_ids_id_dict.pickle \
          genes/nas/results/narG_gold_short_ids_id_dict.pickle \
          genes/nas/results/DMSO_gold_short_ids_id_dict.pickle \
          envision/placements/nasA/envis_nas_preprocessed_id_dict.pickle  \
 --taxonomy \
 --label_prefixes "AioAgl_" "NapAgl_" "NarBdb_" "NarBgl_" "NasAdb_" "NasAgl_" "NasCgl_" "NasANgl_" "NasBgl_" "NarGgl_" "DMSOgl_" "Envis_"

but I have encountered this error:

* Relabelling tree...
Traceback (most recent call last):
  File "/media/disk5/nfernandez/TRAITS/code/relabeltree.py", line 130, in <module>
    main()
  File "/media/disk5/nfernandez/TRAITS/code/relabeltree.py", line 116, in main
    relabelTree(
  File "/media/disk5/nfernandez/TRAITS/code/phyloplacement/phylotree.py", line 220, in relabelTree
    leaves = tree.get_terminals()
  File "/media/disk5/nfernandez/opt/miniconda3/envs/traits/lib/python3.9/site-packages/Bio/Phylo/BaseTree.py", line 420, in get_terminals
    return list(self.find_clades(terminal=True, order=order))
  File "/media/disk5/nfernandez/opt/miniconda3/envs/traits/lib/python3.9/site-packages/Bio/Phylo/BaseTree.py", line 44, in _preorder_traverse
    yield from dfs(root)
  File "/media/disk5/nfernandez/opt/miniconda3/envs/traits/lib/python3.9/site-packages/Bio/Phylo/BaseTree.py", line 42, in dfs
    yield from dfs(v)
  File "/media/disk5/nfernandez/opt/miniconda3/envs/traits/lib/python3.9/site-packages/Bio/Phylo/BaseTree.py", line 42, in dfs
    yield from dfs(v)
  File "/media/disk5/nfernandez/opt/miniconda3/envs/traits/lib/python3.9/site-packages/Bio/Phylo/BaseTree.py", line 42, in dfs
    yield from dfs(v)
  [Previous line repeated 991 more times]
  File "/media/disk5/nfernandez/opt/miniconda3/envs/traits/lib/python3.9/site-packages/Bio/Phylo/BaseTree.py", line 41, in dfs
    for v in get_children(elem):
RecursionError: maximum recursion depth exceeded

Any idea?

Robaina commented 2 years ago

Hi,

seems like you are using an older version that depends on Biopython. We fixed this error previously.

Please, make sure your relabeltree.py script uses the right function newRelabelTree:

https://github.com/Robaina/TRAITS/blob/main/code/relabeltree.py