-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathatom.py
151 lines (125 loc) · 4.22 KB
/
atom.py
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
147
148
149
150
151
'''
Author: Pranav Khade(pranavk@iastate.edu)
'''
import numpy
class Atom():
"""This class contains the information about the Atom.
This class contains all the information available about the Atom. The Atom class is the lowest in the hierarchy of the 'molecule' API classes.
the order of hierarchy being: Protein> Model> Chain> Residue> Atom. This class is also the component of the 'molecule' module API.
Please read the Tutorials and Documentation for more details.
Properties created with the ``@property`` decorator should be documented
in the property's getter method.
"""
def __init__(self,id,AtomName,Coordinates,Occupancy,bfactor,Element,Charge,parent):
self.__id=id
self.__AtomName=AtomName
self.__AlternateLocationIndicator=None #remove it later
self.__parent=parent
self.__Coordinates=Coordinates
self.__Occupancy=Occupancy
self.__bfactor=bfactor
self.__SegmentIdentifier=None
self.__Element=Element
#Get Functions
def get_id(self):
"""
:returns: ID of an 'packman.molecule.atom.Atom' object
"""
return self.__id
def get_name(self):
"""
:returns: Name of an 'Atom' object
"""
return self.__AtomName
def get_alternatelocationindicator(self):
"""
:returns: Alternate Location Indicator
"""
return self.__AlternateLocationIndicator
def get_parent(self):
"""
:returns: Parent residue of an 'Atom' Object. (If available)
"""
return self.__parent
def get_location(self):
"""
:returns: Cartesian Coordinates of an 'Atom'
"""
return self.__Coordinates
def get_occupancy(self):
"""
:returns: Occupancy of an 'Atom'
"""
return self.__Occupancy
def get_bfactor(self):
"""
:returns: B-Factor value of an 'Atom'
"""
return self.__bfactor
def get_segmentidentifier(self):
"""
:returns: Segment Identifier of an 'Atom'
"""
return self.__SegmentIdentifier
def get_element(self):
"""
:returns: Element of an 'Atom'
"""
return self.__Element
def get_domain_id(self):
"""
:returns: Domain ID of the parent Residue
"""
return self.get_parent().get_domain_id()
#Set Functions
def set_id(self,new_id):
"""
:param new_id: New ID to be assigned
"""
self.__id=new_id
def set_name(self,new_name):
"""
:param new_name: New name to be assigned
"""
self.__AtomName=new_name
def set_alternatelocationindicator(self,new_alternatelocationindicator):
"""
:param new_alternatelocationindicator: New Alternate Location Indicator to be assigned
"""
self.__AlternateLocationIndicator=new_alternatelocationindicator
def set_parent(self,new_parent):
"""
:param new_parent: New parent to be assigned
"""
self.__parent=new_parent
def set_location(self,new_location):
"""
:param new_location: New Cartesian Coordinates to be assigned
"""
self.__Coordinates=new_location
def set_occupancy(self,new_occupancy):
"""
:param new_occupancy: New occupancy value to be assigned
"""
self.__Occupancy=new_occupancy
def set_bfactor(self,new_bfactor):
"""
:param new_bfactor: New B-Factor to be assigned
"""
self.__bfactor=new_bfactor
def set_segmentidentifier(self,new_segmentidentifier):
"""
:param new_segmentidentifier: New Segment Identifier to be assigned
"""
self.__SegmentIdentifier=new_segmentidentifier
def set_elment(self,new_element):
"""
:param new_element: New element to be assigned
"""
self.__Element=new_element
#Calculation Functions
def calc_dist(self,another_atom):
"""
:param another_atom: 'Atom' object to which the distance should be calculated.
"""
return numpy.linalg.norm(self.__Coordinates-another_atom.get_location())