@@ 1014-1045 (lines=32) @@ | ||
1011 | mapping = [[u'PRP8', 'A', u'skyblue'], [u'BRR2', 'B', u'grey60'], [u'BUD31', 'C', u'dirtyviolet'], [u'CEF1', 'D', u'raspberry'], [u'CLF1', 'E', u'raspberry'], [u'CWC15', 'F', u'dirtyviolet'], [u'CWC16/YJU2', 'G', u'lightteal'], [u'CWC2', 'H', u'ruby'], [u'CWC21', 'I', u'violetpurple'], [u'CWC22', 'J', u'bluewhite'], [u'CWC25', 'K', u'deepteal'], [u'Intron', 'L', u'black'], [u'ISY1', 'M', u'dirtyviolet'], [u'LEA1', 'N', u'palegreen'], [u'Msl1', 'O', u'palegreen'], [u'PRP45', 'P', u'lightpink'], [u'PRP16', 'Q', u'smudge'], [u'CDC40\xa0(PRP17, SLU4, XRS2)', 'R', u'dirtyviolet'], [u'PRP19 (PSO4)', 'S', u'grey70'], [u'PRP46', 'T', u'lightblue'], [u'SLT11/ECM2', 'U', u'chocolate'], [u'SNT309', 'V', u'grey70'], [u'SNU114', 'W', u'slate'], [u'SYF2', 'X', u'brightorange'], [u'SYF1', 'Y', u'brightorange'], [u'U2', 'Z', u'forest'], [u'U5', 'a', u'density'], [u'U5_SmRNP', 'b', u'deepblue'], [u'U6', 'c', u'firebrick'], [u'Intron', 'r', u'grey50'], [u'Exon', 'z', u'yellow'], [u'exon-3', 'y', u'yellow'], [u'exon-5', 'z', u'yellow'], [u'PRP4 ', 'd', u'grey50'], [u'PRP31', 'e', u'grey50'], [u'PRP6', 'f', u'grey50'], [u'PRP3', 'g', u'grey50'], [u'DIB1', 'h', u'grey50'], [u'SNU13', 'i', u'grey50'], [u'LSM8', 'j', u'grey50'], [u'LSM2', 'k', u'grey50'], [u'LSM3', 'l', u'grey50'], [u'LSM6', 'm', u'grey50'], [u'LSM5', 'n', u'grey50'], [u'LSM7', 'o', u'grey50'], [u'LSM4', 'p', u'grey50'], [u'SNU66', 'q', u'grey50'], [u'RNA (intron or U6 snRNA)', 'r', u'grey50'], [u'5EXON', 's', u'grey50'], [u'BUD13', 't', u'grey60'], [u'CLF2', 'u', u'rasberry'], [u'Cus1', 'v', u'palegreen'], [u'CWC24', 'w', u'grey60'], [u'CWC27', 'x', u'grey60'], [u'HSH155', '1', u'smudge'], [u'HSH49', '2', u'sand'], [u'PML1', '3', u'grey60'], [u'PRP11', '4', u'palegreen'], [u'PRP2', '5', u'palegreen'], [u'RDS3', '6', u'palegreen'], [u'RSE1', '7', u'smudge'], [u'SNU17', '8', u'grey60'], [u'Ysf3', '9', u'palegreen'], [u'cwc23', 'd', u'grey50'], [u'SPP382\xa0(CCF8, NTR1)', 'e', u'grey50'], [u'NTR2', 'f', u'grey50'], [u'PRP43', 'g', u'grey50'], [u'SMB1', 'h', u'grey50'], [u'SME1', 'i', u'grey50'], [u'SMX3', 'j', u'grey50'], [u'SMX2\xa0(SNP2)', 'k', u'grey50'], [u'SMD3', 'l', u'grey50'], [u'SMD1', 'm', u'grey50'], [u'SMD2', 'n', u'grey50'], [u'PRP22', 'o', u'grey50'], [u'PRP18', 'p', u'grey50'], [u'SLU7', 'q', u'grey50'], [u'SMF', 'd', u'grey50'], [u'SMG', 'e', u'grey50'], [u'PRP9', 'f', u'grey50'], [u'PRP21', 'g', u'grey50'], [u'SNU23', 'r', u'grey50'], [u'PRP38', 's', u'grey50'], [u'SPP381', 'w', u'grey50']] |
|
1012 | ||
1013 | ||
1014 | def rgyration(selection='(all)', quiet=1): |
|
1015 | ''' |
|
1016 | ||
1017 | [PyMOL] RES: radius of gyration |
|
1018 | From: Tsjerk Wassenaar <tsjerkw@gm...> - 2011-03-31 14:07:03 |
|
1019 | https://sourceforge.net/p/pymol/mailman/message/27288491/ |
|
1020 | DESCRIPTION |
|
1021 | ||
1022 | Calculate radius of gyration |
|
1023 | ||
1024 | USAGE |
|
1025 | ||
1026 | rgyrate [ selection ] |
|
1027 | :::warning::: |
|
1028 | if nothing is selected function is calculating radius of gyration for all pdbs in current Pymol session |
|
1029 | ''' |
|
1030 | try: |
|
1031 | from itertools import izip |
|
1032 | except ImportError: |
|
1033 | izip = zip |
|
1034 | quiet = int(quiet) |
|
1035 | model = cmd.get_model(selection).atom |
|
1036 | x = [i.coord for i in model] |
|
1037 | mass = [i.get_mass() for i in model] |
|
1038 | xm = [(m*i,m*j,m*k) for (i,j,k),m in izip(x,mass)] |
|
1039 | tmass = sum(mass) |
|
1040 | rr = sum(mi*i+mj*j+mk*k for (i,j,k),(mi,mj,mk) in izip(x,xm)) |
|
1041 | mm = sum((sum(i)/tmass)**2 for i in izip(*xm)) |
|
1042 | rg = math.sqrt(rr/tmass - mm) |
|
1043 | if not quiet: |
|
1044 | print("Radius of gyration: %.2f" % (rg)) |
|
1045 | return rg |
|
1046 | ||
1047 | ||
1048 | def rgyrate(selection='(all)', quiet=1): |
|
@@ 1048-1073 (lines=26) @@ | ||
1045 | return rg |
|
1046 | ||
1047 | ||
1048 | def rgyrate(selection='(all)', quiet=1): |
|
1049 | ''' |
|
1050 | DESCRIPTION |
|
1051 | ||
1052 | Radius of gyration |
|
1053 | ||
1054 | USAGE |
|
1055 | ||
1056 | rgyrate [ selection ] |
|
1057 | ''' |
|
1058 | try: |
|
1059 | from itertools import izip |
|
1060 | except ImportError: |
|
1061 | izip = zip |
|
1062 | quiet = int(quiet) |
|
1063 | model = cmd.get_model(selection).atom |
|
1064 | x = [i.coord for i in model] |
|
1065 | mass = [i.get_mass() for i in model] |
|
1066 | xm = [(m*i,m*j,m*k) for (i,j,k),m in izip(x,mass)] |
|
1067 | tmass = sum(mass) |
|
1068 | rr = sum(mi*i+mj*j+mk*k for (i,j,k),(mi,mj,mk) in izip(x,xm)) |
|
1069 | mm = sum((sum(i)/tmass)**2 for i in izip(*xm)) |
|
1070 | rg = math.sqrt(rr/tmass - mm) |
|
1071 | if not quiet: |
|
1072 | print("Radius of gyration: %.2f" % (rg)) |
|
1073 | return rg |
|
1074 | ||
1075 | cmd.extend("rgyrate", rgyrate) |
|
1076 |