From 20e38f57b51666a9a179dd125e728d1c1a79c890 Mon Sep 17 00:00:00 2001 From: Katzlab Date: Tue, 16 Jul 2024 09:23:57 -0400 Subject: [PATCH] Update ColorByClade.py added example use and note on how to turn off rooting --- Utilities/for_trees/ColorByClade.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Utilities/for_trees/ColorByClade.py b/Utilities/for_trees/ColorByClade.py index 4ba3059..eebd72c 100644 --- a/Utilities/for_trees/ColorByClade.py +++ b/Utilities/for_trees/ColorByClade.py @@ -1,10 +1,12 @@ -#Author, date: Auden Cote-L'Heureux & Godwin Ani, last updated Feb 21st 2024 +#Author, date: Auden Cote-L'Heureux & Godwin Ani & LAK, last updated July 16 2024 #Motivation: Visualize placement of taxa by taxonomic group in trees #Intent: Color tip labels in trees by taxonomic group #Dependencies: Python3, ete3 #Inputs: A folder of trees #Outputs: a folder of colored trees #Example: python ColorByClade_v2.1.py -i /path/to/trees +#Example: python ColorByClade_v2.1.py -i /path/to/trees -k keys.txt +#NOTE: turn off rooting at lines 227-229 if you want colored unrooted trees import os, sys, shutil @@ -220,7 +222,8 @@ def tree_formatting_wrapper(file): majs = list(dict.fromkeys([leaf.name[:2] for leaf in tree])) #Only try to reroot trees with more than 2 major clades. This was added to fix the ETE3 "Cannot set myself as outgroup" error - + + #turn off the next three lines to color without rooting if len(majs) > 2: tree = reroot(tree) tree.ladderize(direction = 1)