From 03c4c88d6117d3e6ed933535a533b51719b3f896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas-Fr=C3=A9d=C3=A9ric=20Lipp=2C=20PhD?= <40916571+NicoFrL@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:33:15 -0700 Subject: [PATCH 1/2] Update coloraf.py An updated version for more reliability --- coloraf.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/coloraf.py b/coloraf.py index f631fbd..2907e25 100644 --- a/coloraf.py +++ b/coloraf.py @@ -1,17 +1,25 @@ from pymol import cmd -def coloraf(selection="all"): +def AFcolors(selection="all"): """ AUTHOR - Christian Balbin - + Christian Balbin + + ADAPTATION + Nicolas-Frederic Lipp + DESCRIPTION Colors Alphafold structures by pLDDT + An improved version of the original + Prevent exact values of 90, 70, and 50 from not being recolored. + Ranges were checked on AFDB to ensure that 90, 70, and 50 match their color scheme, despite the nonsensical model confidence legend available on AFDB website. + The colors now match exactly AFDB color scheme + Replace 'coloraf' by 'AFcolors' USAGE - coloraf sele + AFcolors sele PARAMETERS @@ -19,11 +27,11 @@ def coloraf(selection="all"): The name of the selection/object to color by pLDDT. Default: all """ - cmd.color("blue", f"({selection}) and b > 90") - cmd.color("cyan", f"({selection}) and b < 90 and b > 70") - cmd.color("yellow", f"({selection}) and b < 70 and b > 50") - cmd.color("orange", f"({selection}) and b < 50") + cmd.color("0x126DFF", f"({selection}) and (b > 90 or b = 90)") + cmd.color("0x0ECFF1", f"({selection}) and ((b < 90 and b > 70) or b = 70)") + cmd.color("0xF6ED12", f"({selection}) and ((b < 70 and b > 50) or b = 50)") + cmd.color("0xEE831D", f"({selection}) and b < 50") -cmd.extend("coloraf", coloraf) -cmd.auto_arg[0]["coloraf"] = [cmd.object_sc, "object", ""] +cmd.extend("AFcolors", AFcolors) +cmd.auto_arg[0]["AFcolors"] = [cmd.object_sc, "object", ""] From 38bc67bec7a9392533e025d7f340ec8e720e2a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas-Fr=C3=A9d=C3=A9ric=20Lipp=2C=20PhD?= <40916571+NicoFrL@users.noreply.github.com> Date: Tue, 23 Jul 2024 00:08:46 -0700 Subject: [PATCH 2/2] Update coloraf.py update color scheme precisely --- coloraf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coloraf.py b/coloraf.py index 2907e25..c78c95b 100644 --- a/coloraf.py +++ b/coloraf.py @@ -27,10 +27,10 @@ def AFcolors(selection="all"): The name of the selection/object to color by pLDDT. Default: all """ - cmd.color("0x126DFF", f"({selection}) and (b > 90 or b = 90)") - cmd.color("0x0ECFF1", f"({selection}) and ((b < 90 and b > 70) or b = 70)") - cmd.color("0xF6ED12", f"({selection}) and ((b < 70 and b > 50) or b = 50)") - cmd.color("0xEE831D", f"({selection}) and b < 50") + cmd.color("0x0053D6", f"({selection}) and (b > 90 or b = 90)") + cmd.color("0x64CBF3", f"({selection}) and ((b < 90 and b > 70) or b = 70)") + cmd.color("0xFFDB13", f"({selection}) and ((b < 70 and b > 50) or b = 50)") + cmd.color("0xFE7D45", f"({selection}) and b < 50") cmd.extend("AFcolors", AFcolors)