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_dry_pdb(self):
        envelope = self.msms0.envelope_msms.get_vert(filt=False)
        envelope = [(x['x'], x['y'], x['z']) for x in envelope]
        envelope_tree = scipy.spatial.KDTree(envelope)
        npdb_non = NumPdb(self.no_water_file, features=self.npdb_features)
        non_tree = scipy.spatial.KDTree(npdb_non['xyz'])

        pr2 = self.probe_radius * 2
        pr3 = self.probe_radius * 3
        wet_pdb = [(self.dowser.dowser_file, self.dowser_dry_pdb),
                   (self.processed_pdb, self.original_dry_pdb)]
        for pdb_file, out_file in wet_pdb:
            npdb = NumPdb(pdb_file, features=self.npdb_features)
            sele_het = npdb.sele(record="HETATM")
            sele_not_wat = npdb.sele(resname="HOH", invert=True)
            hetero_tree = get_tree(
                npdb.get('xyz', sele=(sele_het & sele_not_wat)))
            sele = npdb.sele()
            i = 0
            for numa in npdb.iter_resno(incomplete=True):
                flag = True
                if numa[0]['resname'] == 'HOH':
                    # assume the first water atom is the oxygen
                    dist_env = envelope_tree.query(numa['xyz'][0])[0]
                    dist_het = hetero_tree.query(numa['xyz'][0])[0]
                    dist_non = non_tree.query(numa['xyz'][0])[0]
                    # TODO het cutoff only for dowser_file
                    if dist_env < pr2 or dist_het < 3.9 or dist_non > pr3:
                        flag = False
                for a in numa._atoms:
                    sele[i] = flag
                    i += 1
            npdb.copy(sele=sele).write2(out_file)
Example #3
0
 def func( self ):
     self.delete_backbone()
             
     npdb=NumPdb( self.pdb_file )
     for i, numa in enumerate( npdb.iter_resno() ):
         sele={'resno':i+1}
         resname1=numa.get('resname') [0]
         resno1=numa.get('resno') [0]
         chain1=numa.get('chain') [0]
         dirg="%s_%s_%i" %(chain1,resname1,resno1)
         
         print resname1, resno1, chain1
         if   numa.get('resname') [0] not in ('ALA', 'GLY'):
             if resname1 in  ('SER','CYS','PRO','ASP','THR','ASN','VAL','GLU','GLN'):
                 SpiderSidechainCorrelation(self.map_file, self.pdb_file, self.pixelsize,self.resolution, resno1, chain1,output_dir=self.subdir(dirg))
             else:            
                 SpiderSidechainCorrelation('deletebb.cpv', self.pdb_file, self.pixelsize,self.resolution, resno1, chain1,output_dir=self.subdir(dirg))
             aaname="%s.%s" %(dirg,'pdb')
             print aaname
             aa=npdb.sele(resname=resname1,resno=resno1)
             dire="%s/%s" %(dirg,aaname)
             npdb.copy(sele=aa).write(dire)
             OriSidechainCorrel('deletebb.cpv',dire,self.pixelsize,self.resolution,resno1,chain1,output_dir=self.subdir(dirg))
         else:
             aaname="%s.%s" %(dirg,'pdb')
             print aaname
             aa=npdb.sele(resname=resname1,resno=resno1)
             dire="%s/%s" %(dirg,aaname)
             if not os.path.exists(self.subdir(dirg)): os.makedirs(self.subdir(dirg))
             npdb.copy(sele=aa).write(dire)
Example #4
0
 def make_final_pdb(self):
     npdb_dow = NumPdb(self.dowser_dry_pdb, features=self.npdb_features)
     npdb_org = NumPdb(self.original_dry_pdb, features=self.npdb_features)
     dow_tree = get_tree(npdb_dow.get('xyz', resname="HOH"))
     sele = npdb_org.sele()
     i = 0
     for numa in npdb_org.iter_resno(incomplete=True):
         flag = False
         if numa[0]['resname'] == 'HOH':
             dist = dow_tree.query(numa['xyz'][0])[0]
             if dist > 2.7:
                 flag = True
         for a in numa._atoms:
             sele[i] = flag
             i += 1
     coords_dow, atoms_dow = npdb_dow._select()
     coords_org, atoms_org = npdb_org._select(sele=sele)
     npdb_final = NumAtoms(np.hstack((atoms_dow, atoms_org)),
                           np.vstack((coords_dow, coords_org)))
     npdb_final.write2(self.final_pdb)
Example #5
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