Пример #1
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)
Пример #2
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)
Пример #3
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
Пример #4
0
 def func (self):
     self.bestbuild()
     npdb=NumPdb( "bestrotamers.pdb" )
     
     a=True
     z=2
     #while a==True:
     clashes,a=find_all_clashes(npdb)
     gtree=get_tree(npdb['xyz'])
     print clashes
     for i in clashes:
         localresi=[]
         #hole CA atom vom ersten clashpartner 
         r=npdb.sele(resno=i[0],atomname='CA')
         p=npdb.get('xyz',sele=r)
         #indices im 6 A umkreis um den clash
         l=gtree.query_ball_point(p,6)
         print l[0]
         #aus den indices eine liste mit residuname und nummer machen
         for x in l[0]:
             a=npdb.get('resname')[x]
             b=npdb.get('resno')[x]
             c=npdb.get('chain')[x]
             localresi.append([b,a,c])
         localresi=sorted(localresi)
         localresi=list(localresi for localresi,_ in itertools.groupby(localresi))
         #print localresi
         for index,i in enumerate (localresi):
             if i[1] not in ('ALA','GLY'):
                 rotadir="%s_%s_%i" % (i[2],i[1],i[0])
                 ccsortpath=os.path.join(self.result_direc,rotadir)
                 ccsort="%s/%s" % (ccsortpath,'ccsort.cpv')
                 print ccsortpath
                 
         break
Пример #5
0
 def _pre_exec( self ):
     backbone = ( ' N  ',' C  ', ' CA ',' O  ' )
     npdb=NumPdb( self.pdb_file )
     back=npdb.sele(atomname=backbone)
     npdb.copy(sele=back).write('nobb.pdb')
     self._make_script_file(
         map_name=self.relpath(self.map_file, no_ext=True) ,
         pixelsize=self.pixelsize,
         pdb_file='nobb.pdb'
     )
Пример #6
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)
Пример #7
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
Пример #8
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)