ColorByGroup

From PyMOLWiki
Revision as of 01:42, 12 November 2018 by Zhentg (talk | contribs) (Created page with "{{Infobox script-repo |type = script |author = Zhenting Gao }} == Introduction == Color the objects by their groups. == Usage == *Open PyMOL *Load PD...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Type Python Script
Download
Author(s) Zhenting Gao
License

Introduction

Color the objects by their groups.

Usage

  • Open PyMOL
  • Load PDB files, create groups
  • run this Python script inside PyMOL
  • call the function
    • colorByGroup

Required Arguments

Text

Optional Arguments

Text

Examples

Text

The Code

def colorByGroup():
	#Based on: https://pymolwiki.org/index.php/Get_Names#ARGUMENTS
	#Author: Zhenting Gao (zhentgpicasa@gmail.com)
	#Update: 11/12/2018
	#Aim: Color atoms of a binding site based on their distance from a point
	# returns the length of the distance between atom A and atom B
	groups=cmd.get_names("group_objects")
	numClusters=len(groups)
	import math
	for x in range(numClusters):
		colorCode=x*int(math.floor(255/numClusters))
		util.cba(colorCode,groups[x])
		print(colorCode,groups[x])
cmd.extend('colorByGroup', colorByGroup)