I have been using GraPhlAn (version 1.1.4) to generate a phylogenetic figure for a project involving 9907 samples. The goal is to annotate each clade and add ring colors based on specific biological conditions.
Annotation Goals:
Ring Colors:
• Each clade in the tree is annotated with a colored ring based on a biological condition:
• Green ( #2E8B57) if the organism belongs to a common_genus_set.
• Black (k) if the condition is not satisfied.
• The color decision is made programmatically, as follows:
ring_color = ‘#2E8B57’ if organism_name in common_genus_set else ‘k’
Problem:
The approach was working previously, but after altering the condition logic in my Python script to account for a new biological function, the graphlan_annotate.py command is failing to generate the XML file correctly. Specifically:
• No error messages are displayed, or the script exits silently without output.
• The XML output is malformed or missing key annotations.
This is the command I used for the annoatation:
graphlan_annotate.py pruned_updated_File01.nwk bioSnT_orgs_new.xml --annot allbact_annot_bioSnT_orgs_TEST.txt
Hi there and thanks for using GraPhlAn and reporting this.
Two things to check:
Could there be extra tabs in your annotations file? If so, they could break the generation of the xml annotated tree
I see you have “black” as color for ring 1, instead of “k” as you did for ring 2. I’m currently traveling and can’t check, but I think “black” won’t be recognized as a valid color, so likely changing “black” to “k” should fix it.
Please let me know if any of these two fix your problem.
Hey Francesco,
I have checked the annotation file again, it does not contain any extra tabs. Moreover, I used a python script to create this annotation file and I haven’t made any errors there!
With respect to the ‘black’ and ‘k’ difference, it was just one of the many things I tried! I also changed that to maintain uniformity! It still throws the same classes not implemented for external annotations error!
Please let me know what’s going wrong here! I have attached the most recent annotation file for your reference!
I checked your annotation file, and it seems the problem is (at least) with the G000195955 leaf label, which is not present in your tree file. There could be others, though. So, I could improve the GraPhlAn code to write out when there are things in the annotations file that do not match the tree file and continue instead of giving a not-very-meaningful error. However, now maybe you can just check that there are no leaf labels in your annotations that are not present in your tree file.
Hey Francesco,
Thank you so much for your help!
I had added one organism to the file and had forgotten about it, which led to this error.
On the other hand, it would be great if the error message was much more detailed in terms of what’s missing and where, along with the “classes not implemented for external annotations” text.