Example #1
0
 def get_npdb_dicts(self):
     mplanes = np.array(self.opm.get_planes())
     dist = abs(point_plane_dist(mplanes[1][0], mplanes[0]))
     npdb_dict = {}
     npdb_tm_dict = {}
     npdb_sol_dict = {}
     for suffix, pdb_file in self.water_variants:
         npdb = NumPdb(pdb_file, features=self.npdb_features)
         npdb_dict[suffix] = npdb
         sele = npdb.sele()
         i = 0
         # create transmembrane region selection
         for numa in npdb.iter_resno(incomplete=True):
             flag = True
             for c in numa._coords:
                 d1 = abs(point_plane_dist(c, mplanes[0]))
                 d2 = abs(point_plane_dist(c, mplanes[1]))
                 if d1 < dist and d2 < dist:
                     flag = False
                     break
             for a in numa._atoms:
                 sele[i] = flag
                 i += 1
         npdb_sol_dict[suffix] = npdb.copy(sele=sele)
         npdb.copy(sele=sele).write(self.outpath("sol_region.pdb"))
         np.logical_not(sele, sele)
         npdb_tm_dict[suffix] = npdb.copy(sele=sele)
         npdb.copy(sele=sele).write(self.outpath("tm_region.pdb"))
     return npdb_dict, npdb_tm_dict, npdb_sol_dict
Example #2
0
 def make_processed_pdb(self):
     npdb = NumPdb(self.opm.processed_file, features=self.npdb_features)
     sele = npdb.sele()
     coords_dict = {}
     i = 0
     tree = scipy.spatial.KDTree(npdb['xyz'])
     for numa in npdb._iter_resno():
         for c in numa._coords:
             c = tuple(c)
             # remove atoms with identical coords
             if c in coords_dict:
                 print npdb._atoms[i]
                 sele[i] = False
             else:
                 coords_dict[c] = True
                 sele[i] = True
                 # remove atoms with almost identical coords
                 rslt = tree.query(c, k=10, distance_upper_bound=0.2)
                 rslt[1].sort()
                 if rslt[1][0] != i and rslt[0][1] != np.inf:
                     print i, npdb._atoms[i]
                     sele[i] = False
             i += 1
     npdb.copy(sele=sele).write2(self.processed_pdb)
Example #3
0
 def get_npdb_dicts(self):
     npdb_dict = {}
     npdb_tm_dict = {}
     npdb_sol_dict = {}
     for suffix, pdb_file in self.water_variants:
         npdb = NumPdb(pdb_file, features=self.npdb_features)
         npdb_dict[suffix] = npdb
         sele = npdb.sele()
         i = 0
         # create transmembrane region selection
         for numa in npdb.iter_resno(incomplete=True):
             flag = True
             for a in numa._atoms:
                 sele[i] = flag
                 i += 1
         npdb_sol_dict[suffix] = npdb.copy(sele=sele)
         npdb.copy(sele=sele).write(self.outpath("sol_region.pdb"))
         np.logical_not(sele, sele)
         npdb_tm_dict[suffix] = npdb.copy(sele=sele)
         npdb.copy(sele=sele).write(self.outpath("tm_region.pdb"))
     return npdb_dict, npdb_tm_dict, npdb_sol_dict