예제 #1
0
    def prepare( self ):
        """
        """
        mrec = self.com.rec()
        mlig = self.com.lig()
        
        m = mrec.concat( mlig )

        if self.protonate:
            if self.verbose:
                self.log.add( '\nRe-building hydrogen atoms...' )
            
            tempdir = self.tempdir
            if tempdir:
                tempdir += '/0_reduce'
                
            r = Reduce( m, tempdir=tempdir, log=self.log,
                        autocap=False,
                        debug=self.debug, verbose=self.verbose )
            m = r.run()
            
        if self.addcharge:
            if self.verbose:
                self.log.add( '\nAssigning charges from Amber topologies...')
                    
            ac = AtomCharger( log=self.log, verbose=self.verbose )
            ac.charge( m )
            
        mrec = m.takeChains( range( mrec.lenChains() ) )
        mlig = m.takeChains( range( mrec.lenChains(), m.lenChains() ) )
            
        self.delphicom = Complex( mrec, mlig )
예제 #2
0
    def prepare(self):
        """
        """
        mrec = self.com.rec()
        mlig = self.com.lig()

        m = mrec.concat(mlig)

        if self.protonate:
            if self.verbose:
                self.log.add('\nRe-building hydrogen atoms...')

            tempdir = self.tempdir
            if tempdir:
                tempdir += '/0_reduce'

            r = Reduce(m,
                       tempdir=tempdir,
                       log=self.log,
                       autocap=False,
                       debug=self.debug,
                       verbose=self.verbose)
            m = r.run()

        if self.addcharge:
            if self.verbose:
                self.log.add('\nAssigning charges from Amber topologies...')

            ac = AtomCharger(log=self.log, verbose=self.verbose)
            ac.charge(m)

        mrec = m.takeChains(range(mrec.lenChains()))
        mlig = m.takeChains(range(mrec.lenChains(), m.lenChains()))

        self.delphicom = Complex(mrec, mlig)
예제 #3
0
    def test_delphiCharges2(self):
        """
        PDB2DelphiCharges test
        """
        if self.local:
            T.errWrite('loading PDB...')

        self.m1 = self.MODEL or PDBModel(T.testRoot('lig/1A19_dry.model'))
        Test.MODEL = self.m1
        if self.local:
            T.errWriteln('Done.')

        if self.local:
            T.errWrite('Adding hydrogens to model (reduce)...')

        self.rmodel = Reduce(self.m1, verbose=self.local).run()
        self.rmodel.xplor2amber()
        if self.local:
            T.errWriteln('Done.')

        ac = AtomCharger()
        ac.charge(self.rmodel)
        self.rmodel.addChainFromSegid()

        self.dc = PDB2DelphiCharges(self.rmodel)
        self.dc.prepare()

        self.assertEqual(len(self.dc.resmap['LYS']), 2)  # normal and N'
        self.assertEqual(len(self.dc.resmap['SER']), 2)  # normal and C'

        if self.local:
            T.errWriteln('writing delphi charge file to %s' % self.fcrg)
        self.dc.tofile(self.fcrg)

        self.assertTrue(os.path.exists(self.fcrg))
예제 #4
0
파일: delphi.py 프로젝트: graik/biskit
    def test_delphiCharges2( self ):
        """
        PDB2DelphiCharges test
        """
        if self.local:
            T.errWrite( 'loading PDB...' )

        self.m1 = self.MODEL or PDBModel( T.testRoot( 'lig/1A19_dry.model' ) )
        Test.MODEL = self.m1
        if self.local:
            T.errWriteln( 'Done.' )
        
        if self.local:
            T.errWrite( 'Adding hydrogens to model (reduce)...' )

        self.rmodel = Reduce( self.m1, verbose=self.local ).run()
        self.rmodel.xplor2amber()
        if self.local:
            T.errWriteln( 'Done.' )

        ac = AtomCharger()
        ac.charge(self.rmodel)
        self.rmodel.addChainFromSegid()
        
        self.dc = PDB2DelphiCharges( self.rmodel )
        self.dc.prepare()
        
        self.assertEqual( len(self.dc.resmap['LYS']), 2 )  # normal and N'
        self.assertEqual( len(self.dc.resmap['SER']), 2 )  # normal and C'
        
        if self.local:
            T.errWriteln( 'writing delphi charge file to %s' % self.fcrg )
        self.dc.tofile( self.fcrg )
        
        self.assertTrue( os.path.exists( self.fcrg ) )
예제 #5
0
    def __prepareCharges(self, f_out):

        try:
            if self.addcharge:
                if self.verbose:
                    self.log.add(
                        '\nAssigning atomic charges with AtomCharger...')

                if self.topologies is None:
                    reslib = None
                else:
                    reslib = AmberResidueLibrary(self.topologies,
                                                 log=self.log,
                                                 verbose=self.verbose)
                ac = AtomCharger(reslibrary=reslib,
                                 log=self.log,
                                 verbose=self.verbose)
                ac.charge(self.delphimodel)

            if self.verbose:
                self.log.add('Creating Delphi charge file %s' % f_out)

            dc = PDB2DelphiCharges(self.delphimodel)
            dc.prepare()
            dc.tofile(f_out)

            if self.verbose:
                qmissing = self.delphimodel['partial_charge'] == 0
                self.log.add('\nAtoms without charges: %i' % N.sum(qmissing))
                if N.sum(qmissing) > 0:
                    self.log.add('Warning: there are atoms without charge:')
                    m = self.delphimodel.compress(qmissing)
                    for a in m:
                        self.log.add(
                            '%(serial_number)4i %(name)-4s %(residue_name)3s %(residue_number)3i %(chain_id)s'\
                            % a)

        except IOError as why:
            raise IOError('Error creating custom delphi charge file '+f_out+\
                  '( '+str(why)+' )')
예제 #6
0
파일: delphi.py 프로젝트: graik/biskit
    def __prepareCharges(self, f_out ):

        try:
            if self.addcharge:
                if self.verbose:
                    self.log.add(
                        '\nAssigning atomic charges with AtomCharger...')
    
                if self.topologies is None:
                    reslib = None
                else:
                    reslib = AmberResidueLibrary(self.topologies,log=self.log,
                                                 verbose=self.verbose)
                ac = AtomCharger( reslibrary=reslib, 
                                  log=self.log, verbose=self.verbose )
                ac.charge( self.delphimodel )
            
            if self.verbose:
                self.log.add('Creating Delphi charge file %s'%f_out)

            dc = PDB2DelphiCharges( self.delphimodel )
            dc.prepare()
            dc.tofile( f_out )
            
            if self.verbose:
                qmissing = self.delphimodel['partial_charge']==0
                self.log.add('\nAtoms without charges: %i' % N.sum(qmissing))
                if N.sum(qmissing) > 0:
                    self.log.add('Warning: there are atoms without charge:')
                    m = self.delphimodel.compress( qmissing )
                    for a in m:
                        self.log.add(
                            '%(serial_number)4i %(name)-4s %(residue_name)3s %(residue_number)3i %(chain_id)s'\
                            % a)

        except IOError as why: 
            raise IOError('Error creating custom delphi charge file '+f_out+\
                  '( '+str(why)+' )')
예제 #7
0
    def prepare(self):
        if not 'partial_charge' in self.model.atoms:
            ac = AtomCharger()
            ac.charge(self.model)

        self.resmap = self.mapResidues()
예제 #8
0
파일: delphi.py 프로젝트: graik/biskit
 def prepare( self ):
     if not 'partial_charge' in self.model.atoms:
         ac = AtomCharger()
         ac.charge( self.model )
     
     self.resmap = self.mapResidues()