def neighbours(atom, test_atoms, distance): results = [] for test_atom in test_atoms: if v3.distance(test_atom.pos, atom.pos) < distance: if abs(test_atom.res_num - atom.res_num) > 2: results.append(test_atom) return results
def in_contact(res1, res2): for a1 in res1.atoms(): for a2 in res2.atoms(): if v3.distance(a1.pos, a2.pos) < 4: return True return False
results = [] for test_atom in test_atoms: if v3.distance(test_atom.pos, atom.pos) < distance: if abs(test_atom.res_num - atom.res_num) > 2: results.append(test_atom) return results atoms = soup.atoms() nitrogens = filter(lambda a: a.element=="N", atoms) oxygens = filter(lambda a: a.element=="O", atoms) print "Hydrogen bonds:" for oxygen in oxygens: bonded_nitrogens = neighbours(oxygen, nitrogens, 3.5) for nitrogen in bonded_nitrogens: d = v3.distance(oxygen.pos, nitrogen.pos) print (str(oxygen), str(nitrogen)), "%.2f" % d # find surface residues/set b-factor using the inbuilt # accessible surface-area calculator with a water probe radius # of 1.4 angstroms. writes out PDB file to be viewed: # >> pdbshow -b 1be9.asa.pdb # And: # >> pdbshow -b 1be9.res.asa.pdb atoms = [] for res in soup.residues(): if res.type not in data.solvent_res_types: atoms.extend(res.atoms())
for test_atom in test_atoms: if v3.distance(test_atom.pos, atom.pos) < distance: if abs(test_atom.res_num - atom.res_num) > 2: results.append(test_atom) return results atoms = soup.atoms() nitrogens = filter(lambda a: a.element == "N", atoms) oxygens = filter(lambda a: a.element == "O", atoms) print "Hydrogen bonds:" for oxygen in oxygens: bonded_nitrogens = neighbours(oxygen, nitrogens, 3.5) for nitrogen in bonded_nitrogens: d = v3.distance(oxygen.pos, nitrogen.pos) print(str(oxygen), str(nitrogen)), "%.2f" % d # find surface residues/set b-factor using the inbuilt # accessible surface-area calculator with a water probe radius # of 1.4 angstroms. writes out PDB file to be viewed: # >> pdbshow -b 1be9.asa.pdb # And: # >> pdbshow -b 1be9.res.asa.pdb atoms = [] for res in soup.residues(): if res.type not in data.solvent_res_types: atoms.extend(res.atoms()) pdbatoms.add_radii(atoms) areas = asa.calculate_asa(atoms, 1.4)