-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpymolNMR.py
More file actions
146 lines (129 loc) · 5.68 KB
/
Copy pathpymolNMR.py
File metadata and controls
146 lines (129 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
"""Main module declaring the module for pymol
contains interface for command line functions :
load CNS or DYANA distances constraints files
into molecular viewer, display them on the molecule
and show unSatisfied constraints according to a cutOff
with different color (White for not unSatisfied, blue for
lower limit violation, red for upper limit violation for NOEs)
"""
# Copyright Notice
# ================
#
# The PyMOL Plugin source code in this file is copyrighted, but you can
# freely use and copy it as long as you don't change or remove any of
# the copyright notices.
#
# ----------------------------------------------------------------------
# This PyMOL Plugin is Copyright (C) 2013 by
# olivier serve <olivier dot serve at gmail dot com>
#
# All Rights Reserved
#
# Permission to use, copy, modify, distribute, and distribute modified
# versions of this software and its documentation for any purpose and
# without fee is hereby granted, provided that the above copyright
# notice appear in all copies and that both the copyright notice and
# this permission notice appear in supporting documentation, and that
# the name(s) of the author(s) not be used in advertising or publicity
# pertaining to distribution of the software without specific, written
# prior permission.
#
# THE AUTHOR(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
# NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# ----------------------------------------------------------------------
from sys import stderr, version_info
if version_info[0] < 3:
import Tkinter as Tk
else:
import tkinter as Tk
from Application.Core.NMRCore import NMRCore
from Application.NMRApplication import NMRApplication
import Application.GUI.Panels.appDefaults as appDefaults
appDefaults.loadDefaults()
Core = NMRCore()
pyNMR = NMRApplication(Core)
def __init__(self):
"""Add the plugin to Pymol main menu
"""
self.menuBar.addmenuitem('Plugin', 'command',
'PyNMR',
label='PyNMR...',
command=NMR_GUI)
PyNMRCLI = pyNMR.NMRCLI
def showNOE(structure='', managerName="", residuesList='all',
dist_range='all', violationState='all',
violCutoff=appDefaults.defaultForParameter("cutOff"),
method=appDefaults.defaultForParameter('method'),
radius=appDefaults.defaultForParameter("radius"),
colors=appDefaults.defaultForParameter("colors"),
rangeCutOff=appDefaults.defaultForParameter("rangeCutOff"),
UnSatisfactionMarker=appDefaults.defaultForParameter("UnSatisfactionMarker"),
SatisfactionMarker=appDefaults.defaultForParameter("SatisfactionMarker")):
"""
"""
PyNMRCLI.showNOE(structure, managerName, residuesList, dist_range,
violationState, violCutoff, method, radius, colors,
rangeCutOff, UnSatisfactionMarker, SatisfactionMarker)
def LoadConstraints(filename=""):
"""
"""
PyNMRCLI.LoadConstraints(filename)
def showNOEDensity(structure='', managerName="", residuesList='all',
dist_range='all', violationState='all',
violCutoff=appDefaults.defaultForParameter("cutOff"),
rangeCutOff=appDefaults.defaultForParameter("rangeCutOff"),
method=appDefaults.defaultForParameter('method'),
colors=appDefaults.defaultForParameter("gradient")):
"""
"""
PyNMRCLI.showNOEDensity(structure, managerName, residuesList,
dist_range, violationState, violCutoff, rangeCutOff,
method, colors)
def loadAndShow(filename, structure='', residuesList='all', dist_range='all',
violationState='all',
violCutoff=appDefaults.defaultForParameter("cutOff"),
method=appDefaults.defaultForParameter('method'),
rangeCutOff=appDefaults.defaultForParameter("rangeCutOff"),
radius=appDefaults.defaultForParameter("radius"),
colors=appDefaults.defaultForParameter("colors"),
UnSatisfactionMarker=appDefaults.defaultForParameter("UnSatisfactionMarker"),
SatisfactionMarker=appDefaults.defaultForParameter("SatisfactionMarker")):
"""
"""
PyNMRCLI.loadAndShow(filename, structure, residuesList, dist_range,
violationState, violCutoff, method, rangeCutOff,
radius, colors, UnSatisfactionMarker,
SatisfactionMarker)
def downloadNMR(pdbCode, url=appDefaults.defaultForParameter("urlPDB")):
"""
"""
PyNMRCLI.downloadNMR(pdbCode, url)
def cleanScreen(filename):
"""
"""
PyNMRCLI.cleanScreen(filename)
def NMR_GUI():
from pymol import plugins
root = plugins.get_tk_root()
app = plugins.get_pmgapp()
pyNMR.startGUI(Tk.Toplevel(root))
if __name__ == "__main__":
MainWin = Tk.Tk()
pyNMR.startGUI(MainWin)
MainWin.mainloop()
try:
from pymol.cmd import extend
extend("load_Constraints", LoadConstraints)
extend("showNOE", showNOE)
extend("showNOEDensity", showNOEDensity)
extend("loadAndShow", loadAndShow)
extend("downloadNMR", downloadNMR)
extend("cleanScreen", cleanScreen)
extend("NMR_GUI", NMR_GUI)
except ImportError:
stderr.write("Demo mode.\n")