rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if numpy.allclose(Tr2, 0.0) or type(Tr2)==complex:
if numpy.allclose(Tr2, 0.0) or type(Tr2)==numpy.complex_:
def calc_TLS_center_of_reaction(T0, L0, S0, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center of Reaction...
if numpy.allclose(Tr3, 0.0) or type(Tr3)==complex:
if numpy.allclose(Tr3, 0.0) or type(Tr3)==numpy.complex_:
def calc_TLS_center_of_reaction(T0, L0, S0, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center of Reaction...
tls_file = TLSFile() tls_file.set_file_format(TLSFileFormatTLSOUT()) tls_file.load(open(tlsin, "r")) for tls_desc in tls_file.tls_desc_list:
tls_desc_list = tls_file_format.load(open(tlsin, "r")) for tls_desc in tls_desc_list: tls_file.tls_desc_list.append(tls_desc)
def refmac5_prep(xyzin, tlsin_list, xyzout, tlsout): """Use TLS model + Uiso for each atom. Output xyzout with the residual Uiso only. """ os.umask(022) ## load structure struct = LoadStructure(fil = xyzin) ## load and construct TLS groups tls_group_list = [] for tlsin in tlsin_list: tls_file = TLSFile() tls_file.s...
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin):
def calc_TLS_center_of_reaction(T0, L0, S0, origin):
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
(eval_L, evec_L) = eigenvectors(L_orig)
(eval_L, RL) = eigenvectors(L0) if allclose(determinant(RL), -1.0): I = identity(3, Float) I[0,0] = -1.0 RL = matrixmultiply(I, RL) RLt = transpose(RL)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
rdict["L1_eigen_vec"] = evec_L[0] rdict["L2_eigen_vec"] = evec_L[1] rdict["L3_eigen_vec"] = evec_L[2] evec_L = transpose(evec_L)
rdict["L1_eigen_vec"] = RL[0].copy() rdict["L2_eigen_vec"] = RL[1].copy() rdict["L3_eigen_vec"] = RL[2].copy()
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
cL = zeros([3,3], Float) cL[0,0] = eval_L[0] cL[1,1] = eval_L[1] cL[2,2] = eval_L[2]
cL = matrixmultiply(matrixmultiply(RL, L0), RLt)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
cT = matrixmultiply( matrixmultiply(transpose(evec_L), T_orig), evec_L)
cT = matrixmultiply(matrixmultiply(RL, T0), RLt)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
cS = matrixmultiply( matrixmultiply(transpose(evec_L), S_orig), evec_L) det = determinant(evec_L) if int(det) != 1: cS = -cS
cS = matrixmultiply(matrixmultiply(RL, S0), RLt)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
rho = matrixmultiply(evec_L, crho)
rho = matrixmultiply(RLt, crho)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
rdict["COR"] = origin + rho.copy()
rdict["COR"] = origin + rho
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
St = transpose(S_orig)
St = transpose(S0)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
Sp = S_orig + matrixmultiply(L_orig, PRHOt)
Sp = S0 + matrixmultiply(L0, PRHOt)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
Tp = T_orig + \ matrixmultiply(PRHO, S_orig) + \
Tp = T0 + \ matrixmultiply(PRHO, S0) + \
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
matrixmultiply(matrixmultiply(PRHO, L_orig), PRHOt)
matrixmultiply(matrixmultiply(PRHO, L0), PRHOt)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
rdict["L'"] = L_orig.copy()
rdict["L'"] = L0.copy()
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
rdict["L1_rho"] = matrixmultiply(evec_L, cL1rho) rdict["L2_rho"] = matrixmultiply(evec_L, cL2rho) rdict["L3_rho"] = matrixmultiply(evec_L, cL3rho)
rdict["L1_rho"] = matrixmultiply(RLt, cL1rho) rdict["L2_rho"] = matrixmultiply(RLt, cL2rho) rdict["L3_rho"] = matrixmultiply(RLt, cL3rho)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
rdict["rT'"] = matrixmultiply( transpose(evec_L), matrixmultiply(cTred, evec_L))
rdict["rT'"] = matrixmultiply(matrixmultiply(RLt, cTred), RL)
def calc_TLS_center_of_reaction(T_orig, L_orig, S_orig, origin): """Calculate new tensors based on the center for reaction. This method returns a dictionary of the calculations: T^: T tensor in the coordinate system of L L^: L tensor in the coordinate system of L S^: S tensor in the coordinate system of L COR: Center...
if not self.default_model:
if self.default_model==None:
def get_chain(self, chain_id): """Returns the Chain object matching the chain_id charactor. """ if not self.default_model: return None if self.default_model.chain_dict.has_key(chain_id): return self.default_model.chain_dict[chain_id] return None
if not atm1.get_bond(atm2):
if atm1.get_bond(atm2)==None:
def add_bonds_from_covalent_distance(self): """Builds a Structure's bonds by atomic distance distance using the covalent radii in element.cif. A bond is built if the the distance between them is less than or equal to the sum of their covalent radii + 0.54A. """ for model in self.iter_models(): xyzdict = XYZDict(2.0) ...
if self.chain_dict.has_key(chain.chain_id):
if self.chain_dict.has_key(chain.chain_id)==True:
def add_chain(self, chain, delay_sort=False): """Adds a Chain to the Model. """ assert isinstance(chain, Chain)
if not frag.is_standard_residue():
if frag.is_standard_residue()==False:
def iter_non_standard_residues(self): for frag in self.iter_fragments(): if not frag.is_standard_residue(): yield frag
self.structure.sort()
self.structure.model_list.sort()
def set_model_id(self, model_id): """Sets the model_id of all contained objects. """ assert type(model_id)==IntType
if not frag.is_standard_residue():
if frag.is_standard_residue()==False:
def has_non_standard_residues(self): for frag in self.fragment_list: if not frag.is_standard_residue(): return True return False
if not frag.is_standard_residue():
if frag.is_standard_residue()==False:
def count_non_standard_residues(self): n = 0 for frag in self.fragment_list: if not frag.is_standard_residue(): n += 1 return n
if not frag.is_standard_residue():
if frag.is_standard_residue()==False:
def iter_non_standard_residues(self): for frag in self.fragment_list: if not frag.is_standard_residue(): yield frag
if library_is_amino_acid(atom.res_name):
if library_is_amino_acid(atom.res_name)==True:
def add_atom(self, atom, delay_sort=False): """Adds a Atom. """ assert isinstance(atom, Atom) assert atom.model_id==self.model_id assert atom.chain_id==self.chain_id
elif library_is_nucleic_acid(atom.res_name):
elif library_is_nucleic_acid(atom.res_name)==True:
def add_atom(self, atom, delay_sort=False): """Adds a Atom. """ assert isinstance(atom, Atom) assert atom.model_id==self.model_id assert atom.chain_id==self.chain_id
def set_model_id(self, model_id): """Sets the model_id of all contained objects. """ assert type(model_id)==IntType self.model_id = model_id for frag in self.iter_fragments(): frag.set_model_id(model_id)
def remove_fragment(self, fragment): """Remove the Fragment from the Chain. """ Segment.remove_fragment(self, fragment) fragment.chain = None
self.model.structure.sort()
self.model.chain_list.sort()
def set_chain_id(self, chain_id): """Sets a new ID for the Chain, updating the chain_id for all objects in the Structure hierarchy. """ ## check for conflicting chain_id in the structure if self.model!=None: chk_chain = self.model.get_chain(chain_id) if chk_chain!=None or chk_chain!=self: raise ChainOverwrite()
name = copy.deepcopy(self.name), alt_loc = copy.deepcopy(self.alt_loc), res_name = copy.deepcopy(self.res_name), fragment_id = copy.deepcopy(self.fragment_id), chain_id = copy.deepcopy(self.chain_id), model_id = copy.deepcopy(self.model_id), element = copy.deepcopy(se...
name = self.name, alt_loc = self.alt_loc, res_name = self.res_name, fragment_id = self.fragment_id, chain_id = self.chain_id, model_id = copy.copy(self.model_id), element = self.element,
def __deepcopy__(self, memo): atom_cpy = Atom( name = copy.deepcopy(self.name), alt_loc = copy.deepcopy(self.alt_loc), res_name = copy.deepcopy(self.res_name), fragment_id = copy.deepcopy(self.fragment_id), chain_id = copy.deepcopy(self.chain_id), model_id = copy.deepcopy(sel...
temp_factor = copy.deepcopy(self.temp_factor), sig_temp_factor = copy.deepcopy(self.sig_temp_factor), occupancy = copy.deepcopy(self.occupancy), sig_occupancy = copy.deepcopy(self.sig_occupancy), charge = copy.deepcopy(self.charge), U = copy.deepcopy(self.U, memo), sig_U = c...
temp_factor = copy.copy(self.temp_factor), sig_temp_factor = copy.copy(self.sig_temp_factor), occupancy = copy.copy(self.occupancy), sig_occupancy = copy.copy(self.sig_occupancy), charge = copy.copy(self.charge), U = copy.deepcopy(self.U), sig_U = copy.deepcopy(self.sig_U))
def __deepcopy__(self, memo): atom_cpy = Atom( name = copy.deepcopy(self.name), alt_loc = copy.deepcopy(self.alt_loc), res_name = copy.deepcopy(self.res_name), fragment_id = copy.deepcopy(self.fragment_id), chain_id = copy.deepcopy(self.chain_id), model_id = copy.deepcopy(sel...
if not self.altloc:
if self.altloc==None:
def __iter__(self): """Iterates over all Altloc representations of this Atom. """ if not self.altloc: yield self
if self.default_model==None:
if not self.default_model:
def add_model(self, model, delay_sort=True): """Adds a Model to a Structure. Raises the ModelOverwrite exception if the model_id of the Model matches the model_id of a Model already in the Structure. If there are no Models in the Structure, the Model is used as the default Model. """ assert isinstance(model, Model)
return self.default_model.iter_alpha_helicies()
if self.default_model: return self.default_model.iter_alpha_helicies()
def iter_alpha_helicies(self): """Iterates over all child AlphaHelix objects in the default Model. """ return self.default_model.iter_alpha_helicies()
assert self.default_model!=None
def add_beta_sheet(self, beta_sheet): """ """ self.default_model.add_beta_sheet(beta_sheet)
return self.default_model.iter_beta_sheets()
if self.default_model: return self.default_model.iter_beta_sheets()
def iter_beta_sheets(self): """Iterate over all beta sheets in the Structure. """ return self.default_model.iter_beta_sheets()
assert self.default_model!=None
def add_site(self, site): """ """ self.default_model.add_site(site)
return self.default_model.iter_sites()
if self.default_model: return self.default_model.iter_sites()
def iter_sites(self): """Iterate over all active/important sites defined in the Structure. """ return self.default_model.iter_sites()
self.glv.roty += 360.0 * ((evx - self.beginx) / float(width)) self.glv.rotx += 360.0 * ((evy - self.beginy) / float(height))
roty = 360.0 * ((evx - self.beginx) / float(width)) rotx += 360.0 * ((evy - self.beginy) / float(height))
def on_mouse_motion(self, event): if event.Dragging()==False: return
class AppFrame(wx.Frame):
class ViewerFrame(wx.Frame):
def glv_redraw(self): self.Refresh(False)
def __init__(self, parent=None, id=-1, title='Title', pos=wx.DefaultPosition, size=(400, 200)): """Create a Frame instance. """
def __init__( self, parent = None, id = -1, title = 'Title', pos = wx.DefaultPosition, size = (400, 200)):
def __init__(self, parent=None, id=-1, title='Title', pos=wx.DefaultPosition, size=(400, 200)): """Create a Frame instance. """ wx.Frame.__init__(self, parent, id, title, pos, size)
self.load_structure(sys.argv[1])
def __init__(self, parent=None, id=-1, title='Title', pos=wx.DefaultPosition, size=(400, 200)): """Create a Frame instance. """ wx.Frame.__init__(self, parent, id, title, pos, size)
class App(wx.App):
class ViewerApp(wx.App):
def add_struct(self, struct): """Adds a structure to this viewer, and returns the GLStructure object so it can be manipulated. """ gl_struct = self.glviewer.glv.glv_add_struct(struct)
self.frame = AppFrame()
self.frame = ViewerFrame()
def OnInit(self): self.frame = AppFrame() self.frame.Show() self.SetTopWindow(self.frame) return True
def main(): app = App()
def main(files): app = ViewerApp() for file in files: app.frame.load_structure(file)
def main(): app = App() app.MainLoop()
main()
main(sys.argv[1:])
def main(): app = App() app.MainLoop()
gl_delete_lists(self.name, 1)
self.gl_delete_list()
def gl_compile_list(self, execute = 0): if self.name != None: gl_delete_lists(self.name, 1) self.name = glGenLists(1)
gl_delete_lists(self.name, 1)
glDeleteLists(self.name, 1)
def gl_delete_list(self): if self.name != None: gl_delete_lists(self.name, 1) self.name = None
gl_call_list(self.name)
glCallList(self.name)
def gl_call_list(self): #print "gl_call_list = ",self.name
analysis_url = "http://veritas.yiqiang.net/~yi/pdb/%s/ANALYSIS" % (pdbid)
analysis_url = "http://skuld.bmsc.washington.edu/~tlsmd/pdb/%s/ANALYSIS" % (pdbid)
def redirect_page(self, pdbid): # check to see if this job is still running try: os.chdir(conf.WEBTLSMDD_PDB_DIR + '/' + pdbid) except OSError: title = "This structure is currently being analyzed, please check back later." page = [self.html_head(title), html_title(title), self.html_foot()] return "".join(page)
def refmac5_prep(pdbin, tlsins, pdbout, tlsout):
def refmac5_prep(xyzin, tlsin, xyzout, tlsout): """Use TLS model + Uiso for each atom. Output xyzout with the residual Uiso only. """
def refmac5_prep(pdbin, tlsins, pdbout, tlsout): os.umask(022) ## load input structure struct = LoadStructure(fil = pdbin) ## load input TLS description tls_file = TLSFile() tls_file.set_file_format(TLSFileFormatTLSOUT()) for tlsin in tlsins: fil = open(tlsin, "r") listx = tls_file.file_format.load(fil) tls_file.tls_...
struct = LoadStructure(fil = pdbin)
struct = LoadStructure(fil = xyzin) tls_group_list = []
def refmac5_prep(pdbin, tlsins, pdbout, tlsout): os.umask(022) ## load input structure struct = LoadStructure(fil = pdbin) ## load input TLS description tls_file = TLSFile() tls_file.set_file_format(TLSFileFormatTLSOUT()) for tlsin in tlsins: fil = open(tlsin, "r") listx = tls_file.file_format.load(fil) tls_file.tls_...
for tlsin in tlsins: fil = open(tlsin, "r") listx = tls_file.file_format.load(fil) tls_file.tls_desc_list += listx tls_group_list = []
tls_file.load(open(tlsin, "r"))
def refmac5_prep(pdbin, tlsins, pdbout, tlsout): os.umask(022) ## load input structure struct = LoadStructure(fil = pdbin) ## load input TLS description tls_file = TLSFile() tls_file.set_file_format(TLSFileFormatTLSOUT()) for tlsin in tlsins: fil = open(tlsin, "r") listx = tls_file.file_format.load(fil) tls_file.tls_...
(tevals, R) = eigenvectors(tls_group.T) tmin = min(tevals) T = matrixmultiply(R, matrixmultiply(tls_group.T, transpose(R))) T = T - (tmin * identity(3, Float)) tls_group.T = matrixmultiply(transpose(R), matrixmultiply(T, R)) bmin = U2B * tmin for atm, U in tls_group.iter_atm_Utls(): btls = U2B * (trace(U)/3.0) biso = ...
min_Uiso = 0.0 max_Uiso = 0.0 n = 0 sum_diff2 = 0.0 for atm, Utls in tls_group.iter_atm_Utls(): for aatm in atm.iter_alt_loc(): tls_tf = trace(Utls)/3.0 ref_tf = trace(aatm.get_U())/3.0 n += 1 sum_diff2 += (tls_tf - ref_tf)**2 if ref_tf>tls_tf: max_Uiso = max(ref_tf - tls_tf, max_Uiso) else: min_Uiso = max(...
def refmac5_prep(pdbin, tlsins, pdbout, tlsout): os.umask(022) ## load input structure struct = LoadStructure(fil = pdbin) ## load input TLS description tls_file = TLSFile() tls_file.set_file_format(TLSFileFormatTLSOUT()) for tlsin in tlsins: fil = open(tlsin, "r") listx = tls_file.file_format.load(fil) tls_file.tls_...
'<p style="font-size:xx-small; margin-top:%dpx; line-height:18px">' % (plot.border_width)]
'<p style="font-size:xx-small; margin-top:%dpx; line-height:12.5px">' % (plot.border_width)]
def html_chain_alignment_plot(self, chain): """generate a plot comparing all segmentations """ plot = sequence_plot.TLSSegmentAlignmentPlot() for ntls, cpartition in chain.partition_collection.iter_ntls_chain_partitions(): plot.add_tls_segmentation(cpartition)
"""Returns the displacment matrix based on rotation about Euler
"""Returns the displacement matrix based on rotation about Euler
def dmatrix(alpha, beta, gamma): """Returns the displacment matrix based on rotation about Euler angles alpha, beta, and gamma. """ return rmatrix(alpha, beta, gamma) - identity(3, Float)
self.zplane = 500.0 self.term_alpha = 1.0
self.zplane = 5000.0 self.term_alpha = 0.75
def __init__(self): self.visible = True self.width = 0 self.height = 0 self.zplane = 500.0
self.lines = ["
self.prompt = "> " self.lines = []
def __init__(self): self.visible = True self.width = 0 self.height = 0 self.zplane = 500.0
if key=='\r': self.lines.insert(0, "
ascii = ord(key) if ascii==13: self.lines.insert(0, self.prompt) elif ascii==8 or ascii==127: ln = self.lines[0] if len(ln)>len(self.prompt): self.lines[0] = ln[:-1]
def keypress(self, key): if key=='\r': self.lines.insert(0, "# ") else: self.lines[0] += key
ambient_light = 0.5 diffuse_light = 1.0 specular_light = 1.0 ambient = (ambient_light, ambient_light, ambient_light, 1.0) diffuse = (diffuse_light, diffuse_light, diffuse_light, 1.0) specular = (specular_light, specular_light, specular_light, 1.0) glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient)
glClear(GL_DEPTH_BUFFER_BIT)
def opengl_render(self): ## setup perspective matrix
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse) glLightfv(GL_LIGHT0, GL_SPECULAR, specular) glLightfv(GL_LIGHT0, GL_POSITION, (0.0, 0.0, -1.0, 0.0))
glLightfv(GL_LIGHT0, GL_AMBIENT, (0.0, 0.0, 0.0, 1.0)) glLightfv(GL_LIGHT0, GL_DIFFUSE, (1.0, 1.0, 1.0, 1.0)) glLightfv(GL_LIGHT0, GL_SPECULAR, (1.0, 1.0, 1.0, 1.0)) glLightfv(GL_LIGHT0, GL_POSITION, (0.0, 0.0, zplane + 10.0, 0.0)) glLightModelfv(GL_LIGHT_MODEL_AMBIENT, (0.2, 0.2, 0.2, 1.0))
def opengl_render(self): ## setup perspective matrix
self.opengl_set_material_rgba(0.0, 1.0, 0.0, self.term_alpha)
glMaterialfv( GL_FRONT, GL_AMBIENT, (0.0, 0.0, 0.0, self.term_alpha)) glMaterialfv( GL_FRONT, GL_DIFFUSE, (0.1, 0.1, 0.1, self.term_alpha)) glMaterialfv( GL_FRONT, GL_SPECULAR, (0.0, 0.1, 0.0, self.term_alpha)) glMaterialfv( GL_FRONT, GL_EMISSION, (0.0, 0.1, 0.0, self.term_alpha)) glMaterialfv(GL_FRONT, GL_SHININES...
def opengl_render(self): ## setup perspective matrix
def opengl_set_material_rgba(self, r, g, b, a): """Creates a stock rendering material colored according to the given RGB values. """ glColor3f(r, g, b) glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, (r, g, b, a)) glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (1.0, 1.0, 1.0, 1.0)) glMaterialfv(GL_FRONT_AND_BACK...
def opengl_set_material_rgba(self, r, g, b, a): """Creates a stock rendering material colored according to the given RGB values. """ glColor3f(r, g, b)
self.glv_add_struct(struct)
glstruct = self.glv_add_struct(struct) for glchain in glstruct.glo_iter_children(): glchain.properties.update( ball_stick = True, ellipse = True)
def load_struct(self, path): """Loads the requested structure. """ info("loading: %s" % (path)) try: struct = LoadStructure( fil = path, build_properties = ("library_bonds","distance_bonds")) except IOError: error("file not found: %s" % (path)) return
l11 = 20 + (segment.index(frag) * 6)
L11 = 20 + (segment.index(frag) * 6)
def calc_CA_pivot_TLS_least_squares_fit(segment, weight_dict=None): """Perform a LSQ-TLS fit on the given Segment object using the TLS model with amino acid side chains which can pivot about the CA atom. This model uses 20 TLS parameters and 6 libration parameters per side chain. """ ## calculate the number of paramet...
set_L_A(A, u11, l11, xs, ys, zs, w)
set_L_A(A, U11, L11, xs, ys, zs, w)
def calc_CA_pivot_TLS_least_squares_fit(segment, weight_dict=None): """Perform a LSQ-TLS fit on the given Segment object using the TLS model with amino acid side chains which can pivot about the CA atom. This model uses 20 TLS parameters and 6 libration parameters per side chain. """ ## calculate the number of paramet...
self.driver.glr_lighting_enable()
def draw_fan(self): """Draws a fan from the TLS group center of reaction to the TLS group backbone atoms. """ COR = self.properties["COR"] r, g, b = self.gldl_property_color_rgbf("tls_color") a = self.properties["fan_opacity"]
self.driver.glr_lighting_disable()
def draw_tls_surface(self, Lx_eigen_vec, Lx_eigen_val, Lx_rho, Lx_pitch): """Draws the TLS probability surface for a single non-intersecting screw axis. Lx_eigen_val is the vaiance (mean square deviation MSD) of the rotation about the Lx_eigen_vec axis. """ ## create a unique list of bonds which will be used to ## ren...
arec2["serial"] = arec1["serial"] arec2["chainID"] = arec1["chainID"] arec2["resName"] = arec1["resName"] arec2["resSeq"] = arec1["resSeq"] arec2["iCode"] = arec1["iCode"] arec2["name"] = arec1["name"] arec2["altLoc"] = arec1["altLoc"] arec2["element"] = arec1["element"] arec2["charge"] = arec1["charge"]
if arec1.has_key("serial"): arec2["serial"] = arec1["serial"] if arec1.has_key("chainID"): arec2["chainID"] = arec1["chainID"] if arec1.has_key("resName"): arec2["resName"] = arec1["resName"] if arec1.has_key("resSeq"): arec2["resSeq"] = arec1["resSeq"] if arec1.has_key("iCode"): arec2["iCode"] = arec1["iCode"] if arec...
def atom_common(arec1, arec2): arec2["serial"] = arec1["serial"] arec2["chainID"] = arec1["chainID"] arec2["resName"] = arec1["resName"] arec2["resSeq"] = arec1["resSeq"] arec2["iCode"] = arec1["iCode"] arec2["name"] = arec1["name"] arec2["altLoc"] = arec1["altLoc"] arec2["element"] = arec1["element"] arec2["ch...
("sgroup", 56, 66, "string", "rjust", None), ("z", 67, 70, "integer", "rjust", None)]
("sgroup", 56, 66, "string", "ljust", None), ("z", 67, 70, "integer", "ljust", None)]
def process(self, recs): """Returns a dictionary with attributes chain_id, num_res, and sequence_list """ seqres = {}
assert atm.occupancy >= 0.0 and atm.occupancy < 1.0
assert atm.occupancy >= 0.0 and atm.occupancy <= 1.0
def calc_atom_weight(atm): """Weight the least-squares fit according to this function. """
def __init__(self, form, text=None):
def __init__(self, form, text):
def __init__(self, form, text=None): Page.__init__(self, form) self.text = text
page = ErrorPage("The Job ID seems to be expired.")
page = ErrorPage(form, "The Job ID seems to be expired.")
def main(): form = cgi.FieldStorage() page = None job_id = check_job_id(form) if job_id==None: page = ErrorPage("The Job ID seems to be expired.") else: page = RefinePrepPage(form) try: print page.html_page() except RefinePrepError, err: text = '<center><p>%s</p></center>' % (err.text) page = ErrorPage(form, text) ...
except KeyError:
except IndexError:
def next_chain_id(suggest_chain_id): if suggest_chain_id != "": try: self.struct[suggest_chain_id] except KeyError: return suggest_chain_id for chain_id in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": try: self.struct[chain_id] except KeyError: return chain_id
u_iso = atm_desc["u_iso"]
def lsq_fit_segment(self, frag_id1, frag_id2): """Performs a LSQ fit of TLS parameters for the protein segment starting with fragment index ifrag_start to (and including) the fragment ifrag_end. """ ## all return values here fit_info = {} ## calculate the start/end indexes of the start fragment ## and end fragment so ...
set_TLSiso_b(B_ISOW, i, u_iso, w)
set_TLSiso_b(B_ISOW, i, atm_desc["u_iso"], w)
def lsq_fit_segment(self, frag_id1, frag_id2): """Performs a LSQ fit of TLS parameters for the protein segment starting with fragment index ifrag_start to (and including) the fragment ifrag_end. """ ## all return values here fit_info = {} ## calculate the start/end indexes of the start fragment ## and end fragment so ...
U_ISOW = matrixmultiply(A_ANISOW, X_ANISO)
def lsq_fit_segment(self, frag_id1, frag_id2): """Performs a LSQ fit of TLS parameters for the protein segment starting with fragment index ifrag_start to (and including) the fragment ifrag_end. """ ## all return values here fit_info = {} ## calculate the start/end indexes of the start fragment ## and end fragment so ...
return TLSGraphChainFastHybrid()
if USE_TLSMDMODULE==True: return TLSGraphChainFastHybrid() else: return TLSGraphChainHybrid()
def NewTLSGraphChain0(tls_model): """Generate and return the proper TLSGraphChain subclass for the requested TLS model. """ if tls_model=="HYBRID": return TLSGraphChainFastHybrid() if tls_model=="ANISO": return TLSGraphChainAnisotropic() if tls_model=="PLUGIN": return TLSGraphChainPlugin() raise Exception()
'<p style="font-size:xx-small; margin-top:%dpx; line-height:12.5px">' % (plot.border_width)]
'<p style="font-size:xx-small; margin-top:%dpx">' % (plot.border_width)] l.append('<ul style="list-style-type:none;margin:0px;padding:0px">')
def html_chain_alignment_plot(self, chain): """generate a plot comparing all segmentations """ plot = sequence_plot.TLSSegmentAlignmentPlot() for ntls, cpartition in chain.partition_collection.iter_ntls_chain_partitions(): plot.add_tls_segmentation(cpartition)
l.append('<a href="
l.append('<li style="line-height:20px"><a href=" l.append('</ul>')
def html_chain_alignment_plot(self, chain): """generate a plot comparing all segmentations """ plot = sequence_plot.TLSSegmentAlignmentPlot() for ntls, cpartition in chain.partition_collection.iter_ntls_chain_partitions(): plot.add_tls_segmentation(cpartition)
self.driver.glr_translate(-rho)
self.driver.glr_translate(rho)
def gldl_iter_multidraw_animate(self): """ """ ## optimization: if a rotation of 0.0 degrees was already ## drawn, then there is no need to draw it again zero_rot = False for Lx_axis, Lx_rho, Lx_pitch, Lx_rot, Lx_scale in ( ("L1_eigen_vec", "L1_rho", "L1_pitch", "L1_rot", "L1_scale"), ("L2_eigen_vec", "L2_rho", "L2_pi...
self.driver.glr_translate(rho + screw)
self.driver.glr_translate(-rho + screw)
def gldl_iter_multidraw_animate(self): """ """ ## optimization: if a rotation of 0.0 degrees was already ## drawn, then there is no need to draw it again zero_rot = False for Lx_axis, Lx_rho, Lx_pitch, Lx_rot, Lx_scale in ( ("L1_eigen_vec", "L1_rho", "L1_pitch", "L1_rot", "L1_scale"), ("L2_eigen_vec", "L2_rho", "L2_pi...
gam = 0.5
gam = 0.50
def draw_tls_surface(self, Lx_eigen_vec, Lx_eigen_val, Lx_rho, Lx_pitch): """Draws the TLS probability surface for a single non-intersecting screw axis. Lx_eigen_val is the vaiance (mean square deviation MSD) of the rotation about the Lx_eigen_vec axis. """ ## create a unique list of bonds which will be used to ## ren...
step1 = rot_step * float(step) step2 = step1 + rot_step
rot_start = rot_step * float(step) rot_end = rot_step * float(step + 1)
def draw_tls_surface(self, Lx_eigen_vec, Lx_eigen_val, Lx_rho, Lx_pitch): """Draws the TLS probability surface for a single non-intersecting screw axis. Lx_eigen_val is the vaiance (mean square deviation MSD) of the rotation about the Lx_eigen_vec axis. """ ## create a unique list of bonds which will be used to ## ren...
rot1 = step1 * sign rot2 = step2 * sign
rot1 = rot_start * sign rot2 = rot_end * sign
def draw_tls_surface(self, Lx_eigen_vec, Lx_eigen_val, Lx_rho, Lx_pitch): """Draws the TLS probability surface for a single non-intersecting screw axis. Lx_eigen_val is the vaiance (mean square deviation MSD) of the rotation about the Lx_eigen_vec axis. """ ## create a unique list of bonds which will be used to ## ren...
self.write(self.form_string(mstring))
self.write(self.form_mstring(mstring))
def write_mstring(self, mstring): self.write(self.form_string(mstring))
sys.stderr.write("Mail Client %s Not Found" % (conf.MSMTP))
sys.stderr.write("mail client not found: %s" % (conf.MSMTP))
def SendEmail(address, subject, body): if not os.path.isfile(conf.MSMTP): sys.stderr.write("Mail Client %s Not Found" % (conf.MSMTP)) return mlist = ["To: %s" % (address), "Subject: %s" % (subject), "", body] ## send mail using msmtp pobj = subprocess.Popen([conf.MSMTP, address], stdin = subprocess.PIPE, stdout = sub...
pobj = subprocess.Popen([conf.MSMTP, address], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, close_fds = True, bufsize = 8192)
try: pobj = subprocess.Popen([conf.MSMTP, address], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, close_fds = True, bufsize = 8192) except OSError: sys.stderr.write("[ERROR] mail client failed to execute: %s" % (conf.MSMTP)) return
def SendEmail(address, subject, body): if not os.path.isfile(conf.MSMTP): sys.stderr.write("Mail Client %s Not Found" % (conf.MSMTP)) return mlist = ["To: %s" % (address), "Subject: %s" % (subject), "", body] ## send mail using msmtp pobj = subprocess.Popen([conf.MSMTP, address], stdin = subprocess.PIPE, stdout = sub...
if records != None: print "%s: %d records in %.2f seconds" % ( path, len(records), sec) else: print "%s: NO RECORDS" % (path)
stats = {} stats["time"] = sec
def read_pdb(path): sec = time.time() records = pdbmodule.read(path) sec = time.time() - sec if records != None: print "%s: %d records in %.2f seconds" % ( path, len(records), sec) else: print "%s: NO RECORDS" % (path) for rec in records: if rec["RECORD"] == "REMARK": try: text = rec["text"] except KeyError: ...
if rec["RECORD"] == "REMARK":
rec_type = rec["RECORD"] if rec_type == "REMARK":
def read_pdb(path): sec = time.time() records = pdbmodule.read(path) sec = time.time() - sec if records != None: print "%s: %d records in %.2f seconds" % ( path, len(records), sec) else: print "%s: NO RECORDS" % (path) for rec in records: if rec["RECORD"] == "REMARK": try: text = rec["text"] except KeyError: ...
pass else: if text.find("RESOLUTION RANGE HIGH") == 1: print text
continue if text.find("RESOLUTION RANGE HIGH") == 1: try: stats["res"] = float(text[33:]) except ValueError: pass elif rec_type == "ATOM " or rec_type == "HETATM": try: stats["atoms"] += 1 except KeyError: stats["atoms"] = 1 elif rec_type == "ANISOU": try: stats["anisou"] += 1 except KeyError: stats["anisou"] = 1 ...
def read_pdb(path): sec = time.time() records = pdbmodule.read(path) sec = time.time() - sec if records != None: print "%s: %d records in %.2f seconds" % ( path, len(records), sec) else: print "%s: NO RECORDS" % (path) for rec in records: if rec["RECORD"] == "REMARK": try: text = rec["text"] except KeyError: ...
print str(i)+": ", read_pdb(pathx)
stats = read_pdb(pathx) print "%d:%s:%s" % (i, pathx, stats)
def read_pdb(path): sec = time.time() records = pdbmodule.read(path) sec = time.time() - sec if records != None: print "%s: %d records in %.2f seconds" % ( path, len(records), sec) else: print "%s: NO RECORDS" % (path) for rec in records: if rec["RECORD"] == "REMARK": try: text = rec["text"] except KeyError: ...
"[Status: %s] " % (jdict.get('status', 'None'))]
"[State: %s] " % (jdict.get('state', 'None'))]
def log_job_end(jdict): ln = "" ln += "[%s]: " % (time.asctime(time.localtime(time.time()))) ln += "Finished Job %s" % (jdict["job_id"]) log_write(ln) ## write to a special log file if jdict.get("private_job", True): private_text = "private" else: private_text = "public" submit_time = jdict.get('submit_time', 0.0) r...
if atmx.name=="CA": yield atmx
if atmx.name in ["N","CA","C","O","CB"]: yield atmx
def iter_protein_atoms(sobjx): for fragx in sobjx.iter_amino_acids(): for atmx in fragx.iter_atoms(): if atmx.name=="CA": yield atmx
"""Iterates over all Atom objects. The iteration is preformed in order according to the Chain and Fragment ordering rules the Atom object is a part of.
"""Iterates over all Atom objects according to the Structure defaults.
def iter_atoms(self): """Iterates over all Atom objects. The iteration is preformed in order according to the Chain and Fragment ordering rules the Atom object is a part of. """ for chain in self.iter_chains(): for atm in chain.iter_atoms(): yield atm
"""Counts all Atom objects in the Structure's default alt_loc.
"""Counts all Atom objects in according to the Structure defaults.
def count_atoms(self): """Counts all Atom objects in the Structure's default alt_loc. """ n = 0 for atm in self.iter_atoms(): n += 1 return n
"""
"""Iterates over all Atom objects including all atoms in multiple conformations.
def iter_all_atoms(self): """ """ for chain in self.iter_chains(): for atm in chain.iter_all_atoms(): yield atm
"""Counts all Atom objects.
"""Counts all Atom objects including all atoms in multiple conformations.
def count_all_atoms(self): """Counts all Atom objects. """ n = 0 for atm in self.iter_all_atoms(): n += 1 return n
"Ethan Merrit")
"Ethan Merritt")
def __init__(self): gtk.Dialog.__init__(self, "About mmCIF Editor", None, 0) self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) self.connect("delete-event", self.delete_event_cb) self.connect("response", self.delete_event_cb)