I have a tree with more than 1000 sequences. I want to colour branches based on a string in the tip labels.
For example, all the branches leading to tip labels that have the word 'bacteria' in, I want to label blue, and those with the word 'archaea' I want to label red.
It is straight forward to do this for the tip labels themselves, just by using ctrl + f, and searching for your string of interest, then selecting a colour, but it seems like it is not possible to also colour the branches. Does anybody know a straightforward way of doing this, ideally without needing to write a script?
Cheers!
The easiest way to manipulate the tip labels, branch labels and colours is to use an annotation file in FigTree.
OK, cool, could you maybe expand on this a bit, perhaps explain how I would do this for the example in my question?
The annotations file is a simple tab-delimited file. The first row should have the annotation names and the first column the taxon names. So:
taxa attrib1 attrib2
Tip1 1.0 1.0
Tip2 2.0 2.0
You can have an annotation file with all taxa and corresponding category you want to use for colouring the tips and branches. This file can be imported into FigTree from File -> Import Annotations... option. If annotations are imported successfully, you can colour the branches and/or tips according to an attribute in the file by selecting the appropriate attribute in the pull-down menu, e.g. Node Labels -> Colour by: Category.
Ref: https://groups.google.com/forum/#!topic/figtree-discuss/UR2rTvtIzcw
Also, it's the branches themselves that I would like to colour, not the branch labels. Cheers
There are lots of results on google and on the github repo/google group for using annotation files. They're just tab delimited files with a list of attributes for each taxa.
OK thanks, I'll take a look
Just consider that you will also need to expend time creating an annotation file for every one of your trees too, so unless you're prepared to script something to write your annotation files for you as well, you may not necessarily see much in the way of a time or effort saving.
Though to be clear, I'm not advocating against automating it, I think that's a good idea generally, rather than relying on GUI tools - but you will have to get your hands dirty writing something that at least resembles some code (even if it's - God forbid - an Excel macro).