From 719ce9bb9dbce34af11ba7817d3754c4f37fd65f Mon Sep 17 00:00:00 2001 From: Katzlab Date: Sat, 20 Jan 2024 16:44:02 -0500 Subject: [PATCH] Added optional line to have keys WITHIN names rather than exclusively at start of name --- Utilities/for_trees/ColorByClade_v2.1.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Utilities/for_trees/ColorByClade_v2.1.py b/Utilities/for_trees/ColorByClade_v2.1.py index a9dd5de..15fab0e 100644 --- a/Utilities/for_trees/ColorByClade_v2.1.py +++ b/Utilities/for_trees/ColorByClade_v2.1.py @@ -250,6 +250,9 @@ def color(file, args): for leaf in tree: keys = sorted([key for key in colors if leaf.name.startswith(key)], key = lambda x : -len(x)) + # the line below allows you to have keys anywhere within name and not just start of name.. to use, you have to # the line above + #keys = sorted([key for key in colors if key in leaf.name], key=lambda x: -len(x)) + if len(keys) > 0: if '[&!color=' in colors[keys[0]]: leaf_colors.append(leaf.name + colors[keys[0]])